codebook: Create PsychDS Codebook from Data

Description Usage Arguments Value Examples

View source: R/codebook.R

Description

Create PsychDS Codebook from Data

Usage

1
2
3
4
5
6
7
8
9
codebook(
  data,
  name = NULL,
  vardesc = list(),
  ...,
  schemaVersion = "Psych-DS 0.1.0",
  return = c("json", "list", "data"),
  interactive = FALSE
)

Arguments

data

The data frame to generate a codebook for

name

The name of this dataset (if NULL, will be the same as data)

vardesc

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, type, propertyID, minValue, maxValue, levels, ordered, na, naValues, alternateName, unitCode

...

Further dataset properties (e.g., description, license, author, citation, funder, url, identifier, keywords, privacyPolicy)

schemaVersion

defaults to "Psych-DS 0.1.0"

return

Whether the output should be in JSON format (json), a list (list) or the reformatted data with the codebook as an attribute (data)

interactive

Whether the function should prompt the user to describe columns and factor levels

Value

a list or json-formatted codebook, or reformatted data withthe codebook as an attribute

Examples

1
2
3
4
5
6
7
8
9
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)

debruine/pdsbuilder documentation built on July 8, 2020, 9:40 p.m.