Extract data from stata file for data dictionary
ds2dd_detailed(
data,
add.auto.id = FALSE,
date.format = "dmy",
form.name = NULL,
field.type = NULL,
field.label = NULL,
field.label.attr = "label",
field.validation = NULL,
metadata = metadata_names,
validate.time = FALSE,
time.var.sel.pos = "[Tt]i[d(me)]",
time.var.sel.neg = "[Dd]at[eo]"
)
list of length 2
data frame
flag to add id column
date format, character string. ymd/dmy/mdy. dafault is dmy.
manually specify form name(s). Vector of length 1 or ncol(data). Default is NULL and "data" is used.
manually specify field type(s). Vector of length 1 or ncol(data). Default is NULL and "text" is used for everything but factors, which wil get "radio".
manually specify field label(s). Vector of length 1 or ncol(data). Default is NULL and colnames(data) is used or attribute `field.label.attr` for haven_labelled data set (imported .dta file with `haven::read_dta()`).
attribute name for named labels for haven_labelled data set (imported .dta file with `haven::read_dta()`. Default is "label"
manually specify field validation(s). Vector of length 1 or ncol(data). Default is NULL and `levels()` are used for factors or attribute `factor.labels.attr` for haven_labelled data set (imported .dta file with `haven::read_dta()`).
redcap metadata headings. Default is REDCapCAST:::metadata_names.
Flag to validate guessed time columns
Positive selection regex string passed to `gues_time_only_filter()` as sel.pos.
Negative selection regex string passed to `gues_time_only_filter()` as sel.neg.
This function is a natural development of the ds2dd() function. It assumes that the first column is the ID-column. No checks. Please, do always inspect the data dictionary before upload.
Ensure, that the data set is formatted with as much information as possible.
`field.type` can be supplied
data <- redcapcast_data
data |> ds2dd_detailed(validate.time = TRUE)
data |> ds2dd_detailed()
iris |> ds2dd_detailed(add.auto.id = TRUE)
mtcars |> ds2dd_detailed(add.auto.id = TRUE)
Run the code above in your browser using DataLab