Convencience function to load datasets downloaded from a Redcap database
Source:R/loadData.R
read_redcap_formatted.Rd
This function is specifically tailored to the way the default import script
provided by a Redcap database functions. First, the Hmisc
package is loaded.
The .csv file containing the data is assumed to be located in the current working directory.
Labels are assigned to all variables. Variables which are supposed to be factors are twice,
once as a factor and once in an unformatted way.
Arguments
- path_to_redcap_script
(character) Path to the (automatically generated) redcap script for data import
Examples
path_to_redcap_script <- system.file("examples", "testredcap.r", package = "DescrTab2")
read_redcap_formatted(path_to_redcap_script)
#> # A tibble: 4 × 5
#> patid redcap_repeat_instrument age sex time
#> <labelled> <fct> <labelled> <fct> <labelled>
#> 1 1 NA 20 Male NA
#> 2 2 NA 25 Female NA
#> 3 2 Interview NA NA 1
#> 4 2 Interview NA NA 2