The data frame to generate a codebook for
The name of this dataset (if NULL, will be the same as `data`, limited to 64 characters)
Optional variable properties in the format of a named list of vectors (can be named or unnamed and in the same order as the data) from the options "description", "privacy", "dataType", "identifier", "minValue", "maxValue", "levels", "levelsOrdered", "na", "naValue", "alternateName", "privacy", "unitCode", "unitText"
Further dataset properties (e.g., description, license, author, citation, funder, url, identifier, keywords, privacyPolicy)
defaults to "Psych-DS 0.1.0"
Whether the output should be in JSON format (json), a list (list) or the reformatted data with the codebook as an attribute (data)
Whether the function should prompt the user to describe columns and factor levels
a list or json-formatted codebook, or reformatted data with the codebook as an attribute
vardesc = list(
description = c("Length of the sepal",
"Width of the sepal",
"Length of the petal",
"Width of the petal",
"The flower species"),
type = c("float", "float", "float", "float", "string")
)
codebook(iris, vardesc = vardesc)
#> Warning: The following variable properties are not standard: type
#> Sepal.Length set to dataType float
#> Sepal.Width set to dataType float
#> Petal.Length set to dataType float
#> Petal.Width set to dataType float
#> Species set to dataType string
#> {
#> "@context": "https://schema.org/",
#> "@type": "Dataset",
#> "name": "iris",
#> "schemaVersion": "Psych-DS 0.1.0",
#> "variableMeasured": [
#> {
#> "@type": "PropertyValue",
#> "name": "Sepal.Length",
#> "description": "Length of the sepal",
#> "type": "float",
#> "dataType": "float"
#> },
#> {
#> "@type": "PropertyValue",
#> "name": "Sepal.Width",
#> "description": "Width of the sepal",
#> "type": "float",
#> "dataType": "float"
#> },
#> {
#> "@type": "PropertyValue",
#> "name": "Petal.Length",
#> "description": "Length of the petal",
#> "type": "float",
#> "dataType": "float"
#> },
#> {
#> "@type": "PropertyValue",
#> "name": "Petal.Width",
#> "description": "Width of the petal",
#> "type": "float",
#> "dataType": "float"
#> },
#> {
#> "@type": "PropertyValue",
#> "name": "Species",
#> "description": "The flower species",
#> "type": "string",
#> "dataType": "string",
#> "levels": {
#> "setosa": "setosa",
#> "versicolor": "versicolor",
#> "virginica": "virginica"
#> },
#> "levelsOrdered": false
#> }
#> ]
#> }
#>