Patient ID <\/span><\/h5> <\/td> [cpr]<\/span><\/h5> <\/td> <\/tr><\/tbody> <\/table> create_html_table(text = paste(\"assessor\", 1:2, sep = \"_\"), variable = c(\"[cpr]\")) #> assessor_1 <\/span><\/h5> <\/td> [cpr]<\/span><\/h5> <\/td> <\/tr> assessor_2 <\/span><\/h5> <\/td> [cpr]<\/span><\/h5> <\/td> <\/tr><\/tbody> <\/table> # create_html_table(text = c(\"CPR nummer\",\"Word\"), variable = c(\"[cpr][1]\", \"[cpr][2]\", \"[test]\"))"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.html","id":null,"dir":"Reference","previous_headings":"","what":"DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta","title":"DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta","text":"Metadata can added editing data dictionary project initial design phase. want later add new instruments, function can used create () instrument(s) add project production.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta","text":"","code":"create_instrument_meta(data, dir = here::here(\"\"), record.id = TRUE)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta","text":"data metadata relevant instrument. `ds2dd_detailed()` dir destination dir instrument zip. Default current WD. record.id flag omit first row data dictionary assuming record_id field included instrument. Default TRUE.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta","text":"list","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/create_instrument_meta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"DEPRICATED Create zips file with necessary content based on data set — create_instrument_meta","text":"","code":"if (FALSE) { # \\dontrun{ data <- iris |> ds2dd_detailed( add.auto.id = TRUE, form.name = sample(c(\"b\", \"c\"), size = 6, replace = TRUE, prob = rep(.5, 2) ) ) |> purrr::pluck(\"meta\") # data |> create_instrument_meta() data <- iris |> ds2dd_detailed(add.auto.id = FALSE) |> purrr::pluck(\"data\") iris |> setNames(glue::glue(\"{sample(x = c('a','b'),size = length(ncol(iris)), replace=TRUE,prob = rep(x=.5,2))}__{names(iris)}\")) |> ds2dd_detailed(form.sep = \"__\") data |> purrr::pluck(\"meta\") |> create_instrument_meta(record.id = FALSE) } # }"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/d2w.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert single digits to words — d2w","title":"Convert single digits to words — d2w","text":"Convert single digits words","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/d2w.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert single digits to words — d2w","text":"","code":"d2w(x, lang = \"en\", neutrum = FALSE, everything = FALSE)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/d2w.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert single digits to words — d2w","text":"x data. Handle vectors, data.frames lists lang language. Danish (da) English (en), Default \"en\" neutrum numbers depending counted word everything flag also split numbers >9 single digits","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/d2w.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert single digits to words — d2w","text":"returns characters format input","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/d2w.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert single digits to words — d2w","text":"","code":"d2w(c(2:8, 21)) #> [1] \"two\" \"three\" \"four\" \"five\" \"six\" \"seven\" \"eight\" \"21\" d2w(data.frame(2:7, 3:8, 1), lang = \"da\", neutrum = TRUE) #> X2.7 X3.8 X1 #> 1 to tre et #> 2 tre fire et #> 3 fire fem et #> 4 fem seks et #> 5 seks syv et #> 6 syv otte et ## If everything=T, also larger numbers are reduced. ## Elements in the list are same length as input d2w(list(2:8, c(2, 6, 4, 23), 2), everything = TRUE) #> [[1]] #> [1] \"two\" \"three\" \"four\" \"five\" \"six\" \"seven\" \"eight\" #> #> [[2]] #> [1] \"two\" \"six\" \"four\" \"two three\" #> #> [[3]] #> [1] \"two\" #>"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.html","id":null,"dir":"Reference","previous_headings":"","what":"Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd","title":"Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd","text":"Works well `project.aid::docx2list()`. Allows defining database text document (see provided template) easier use data base creation. approach allows easier collaboration defining database. generic case data frame variable names values column. format like REDCap data dictionary, gives options formatting.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd","text":"","code":"doc2dd( data, instrument.name, col.variables = 1, list.datetime.format = list(date_dmy = \"_dat[eo]$\", time_hh_mm_ss = \"_ti[md]e?$\"), col.description = NULL, col.condition = NULL, col.subheader = NULL, subheader.tag = \"h2\", condition.minor.sep = \",\", condition.major.sep = \";\", col.calculation = NULL, col.choices = NULL, choices.char.sep = \"/\", missing.default = NA )"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd","text":"data tibble data.frame variable names one column instrument.name character vector length one. Instrument name. col.variables variable names column (default = 1), allows dplyr subsetting list.datetime.format formatting date/time detection. See `case_match_regex_list()` col.description descriptions column, allows dplyr subsetting. empty, variable names used. col.condition conditions branching column, allows dplyr subsetting. See `char2cond()`. col.subheader sub-header column, allows dplyr subsetting. See `format_subheader()`. subheader.tag formatting tag. Default \"h2\" condition.minor.sep condition split minor. See `char2cond()`. Default \",\". condition.major.sep condition split major. See `char2cond()`. Default \";\". col.calculation calculations column. written exact. Character vector. col.choices choices column. See `char2choice()`. choices.char.sep choices split. See `char2choice()`. Default \"/\". missing.default value missing fields. Default NA.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd","text":"tibble data.frame (data)","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/doc2dd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Doc table to data dictionary - EARLY, DOCS MISSING — doc2dd","text":"","code":"# data <- dd_inst # data |> doc2dd(instrument.name = \"evt\", # col.description = 3, # col.condition = 4, # col.subheader = 2, # col.calculation = 5, # col.choices = 6)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.html","id":null,"dir":"Reference","previous_headings":"","what":"(DEPRECATED) Data set to data dictionary function — ds2dd","title":"(DEPRECATED) Data set to data dictionary function — ds2dd","text":"Creates basic data dictionary skeleton. Please see `ds2dd_detailed()` advanced function.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"(DEPRECATED) Data set to data dictionary function — ds2dd","text":"","code":"ds2dd( ds, record.id = \"record_id\", form.name = \"basis\", field.type = \"text\", field.label = NULL, include.column.names = FALSE, metadata = names(REDCapCAST::redcapcast_meta) )"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"(DEPRECATED) Data set to data dictionary function — ds2dd","text":"ds data set record.id name column number id variable, moved first row data dictionary, character integer. Default \"record_id\". form.name vector form names, character string, length 1 length equal number variables. Default \"basis\". field.type vector field types, character string, length 1 length equal number variables. Default \"text. field.label vector form names, character string, length 1 length equal number variables. Default NULL identical field names. include.column.names Flag give detailed output including new column names original data set upload. metadata Metadata column names. Default included names(REDCapCAST::redcapcast_meta).","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"(DEPRECATED) Data set to data dictionary function — ds2dd","text":"data.frame list data.frame vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"(DEPRECATED) Data set to data dictionary function — ds2dd","text":"Migrated stRoke ds2dd(). Fits better functionality 'REDCapCAST'.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"(DEPRECATED) Data set to data dictionary function — ds2dd","text":"","code":"redcapcast_data$record_id <- seq_len(nrow(redcapcast_data)) ds2dd(redcapcast_data, include.column.names=TRUE) #> $DataDictionary #> field_name form_name section_header field_type #> 1 record_id basis NA text #> 2 redcap_event_name basis NA text #> 3 redcap_repeat_instrument basis NA text #> 4 redcap_repeat_instance basis NA text #> 5 cpr basis NA text #> 6 inclusion basis NA text #> 7 inclusion_time basis NA text #> 8 dob basis NA text #> 9 age basis NA text #> 10 age_integer basis NA text #> 11 sex basis NA text #> 12 cohabitation basis NA text #> 13 hypertension basis NA text #> 14 diabetes basis NA text #> 15 region basis NA text #> 16 baseline_data_start_complete basis NA text #> 17 mrs_assessed basis NA text #> 18 mrs_date basis NA text #> 19 mrs_score basis NA text #> 20 mrs_complete basis NA text #> 21 con_mrs basis NA text #> 22 con_calc basis NA text #> 23 consensus_complete basis NA text #> 24 event_datetime basis NA text #> 25 event_age basis NA text #> 26 event_type basis NA text #> 27 new_event_complete basis NA text #> field_label select_choices_or_calculations field_note #> 1 record_id NA NA #> 2 redcap_event_name NA NA #> 3 redcap_repeat_instrument NA NA #> 4 redcap_repeat_instance NA NA #> 5 cpr NA NA #> 6 inclusion NA NA #> 7 inclusion_time NA NA #> 8 dob NA NA #> 9 age NA NA #> 10 age_integer NA NA #> 11 sex NA NA #> 12 cohabitation NA NA #> 13 hypertension NA NA #> 14 diabetes NA NA #> 15 region NA NA #> 16 baseline_data_start_complete NA NA #> 17 mrs_assessed NA NA #> 18 mrs_date NA NA #> 19 mrs_score NA NA #> 20 mrs_complete NA NA #> 21 con_mrs NA NA #> 22 con_calc NA NA #> 23 consensus_complete NA NA #> 24 event_datetime NA NA #> 25 event_age NA NA #> 26 event_type NA NA #> 27 new_event_complete NA NA #> text_validation_type_or_show_slider_number text_validation_min #> 1 NA NA #> 2 NA NA #> 3 NA NA #> 4 NA NA #> 5 NA NA #> 6 NA NA #> 7 NA NA #> 8 NA NA #> 9 NA NA #> 10 NA NA #> 11 NA NA #> 12 NA NA #> 13 NA NA #> 14 NA NA #> 15 NA NA #> 16 NA NA #> 17 NA NA #> 18 NA NA #> 19 NA NA #> 20 NA NA #> 21 NA NA #> 22 NA NA #> 23 NA NA #> 24 NA NA #> 25 NA NA #> 26 NA NA #> 27 NA NA #> text_validation_max identifier branching_logic required_field #> 1 NA NA NA NA #> 2 NA NA NA NA #> 3 NA NA NA NA #> 4 NA NA NA NA #> 5 NA NA NA NA #> 6 NA NA NA NA #> 7 NA NA NA NA #> 8 NA NA NA NA #> 9 NA NA NA NA #> 10 NA NA NA NA #> 11 NA NA NA NA #> 12 NA NA NA NA #> 13 NA NA NA NA #> 14 NA NA NA NA #> 15 NA NA NA NA #> 16 NA NA NA NA #> 17 NA NA NA NA #> 18 NA NA NA NA #> 19 NA NA NA NA #> 20 NA NA NA NA #> 21 NA NA NA NA #> 22 NA NA NA NA #> 23 NA NA NA NA #> 24 NA NA NA NA #> 25 NA NA NA NA #> 26 NA NA NA NA #> 27 NA NA NA NA #> custom_alignment question_number matrix_group_name matrix_ranking #> 1 NA NA NA NA #> 2 NA NA NA NA #> 3 NA NA NA NA #> 4 NA NA NA NA #> 5 NA NA NA NA #> 6 NA NA NA NA #> 7 NA NA NA NA #> 8 NA NA NA NA #> 9 NA NA NA NA #> 10 NA NA NA NA #> 11 NA NA NA NA #> 12 NA NA NA NA #> 13 NA NA NA NA #> 14 NA NA NA NA #> 15 NA NA NA NA #> 16 NA NA NA NA #> 17 NA NA NA NA #> 18 NA NA NA NA #> 19 NA NA NA NA #> 20 NA NA NA NA #> 21 NA NA NA NA #> 22 NA NA NA NA #> 23 NA NA NA NA #> 24 NA NA NA NA #> 25 NA NA NA NA #> 26 NA NA NA NA #> 27 NA NA NA NA #> field_annotation #> 1 NA #> 2 NA #> 3 NA #> 4 NA #> 5 NA #> 6 NA #> 7 NA #> 8 NA #> 9 NA #> 10 NA #> 11 NA #> 12 NA #> 13 NA #> 14 NA #> 15 NA #> 16 NA #> 17 NA #> 18 NA #> 19 NA #> 20 NA #> 21 NA #> 22 NA #> 23 NA #> 24 NA #> 25 NA #> 26 NA #> 27 NA #> #> $`Column names` #> [1] \"record_id\" \"redcap_event_name\" #> [3] \"redcap_repeat_instrument\" \"redcap_repeat_instance\" #> [5] \"cpr\" \"inclusion\" #> [7] \"inclusion_time\" \"dob\" #> [9] \"age\" \"age_integer\" #> [11] \"sex\" \"cohabitation\" #> [13] \"hypertension\" \"diabetes\" #> [15] \"region\" \"baseline_data_start_complete\" #> [17] \"mrs_assessed\" \"mrs_date\" #> [19] \"mrs_score\" \"mrs_complete\" #> [21] \"con_mrs\" \"con_calc\" #> [23] \"consensus_complete\" \"event_datetime\" #> [25] \"event_age\" \"event_type\" #> [27] \"new_event_complete\" #>"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract data from stata file for data dictionary — ds2dd_detailed","title":"Extract data from stata file for data dictionary — ds2dd_detailed","text":"Extract data stata file data dictionary","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract data from stata file for data dictionary — ds2dd_detailed","text":"","code":"ds2dd_detailed( data, add.auto.id = FALSE, date.format = \"dmy\", form.name = NULL, form.sep = NULL, form.prefix = TRUE, field.type = NULL, field.label = NULL, field.label.attr = \"label\", field.validation = NULL, metadata = names(REDCapCAST::redcapcast_meta), convert.logicals = TRUE )"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract data from stata file for data dictionary — ds2dd_detailed","text":"data data frame add.auto.id flag add id column date.format date format, character string. ymd/dmy/mdy. dafault dmy. form.name manually specify form name(s). Vector length 1 ncol(data). Default NULL \"data\" used. form.sep supplied dataset form names suffix prefix column/variable names, seperator can specified. supplied, form.name ignored. Default NULL. form.prefix Flag set form prefix (TRUE) suffix (FALSE) column names. Assumes columns pre- suffix specified. field.type manually specify field type(s). Vector length 1 ncol(data). Default NULL \"text\" used everything factors, wil get \"radio\". field.label manually specify field label(s). Vector length 1 ncol(data). Default NULL colnames(data) used attribute `field.label.attr` haven_labelled data set (imported .dta file `haven::read_dta()`). field.label.attr attribute name named labels haven_labelled data set (imported .dta file `haven::read_dta()`. Default \"label\" field.validation manually specify field validation(s). Vector length 1 ncol(data). Default NULL `levels()` used factors attribute `factor.labels.attr` haven_labelled data set (imported .dta file `haven::read_dta()`). metadata redcap metadata headings. Default names(REDCapCAST::redcapcast_meta). convert.logicals convert logicals factor. Default TRUE.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract data from stata file for data dictionary — ds2dd_detailed","text":"list length 2","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Extract data from stata file for data dictionary — ds2dd_detailed","text":"function natural development ds2dd() function. assumes first column ID-column. checks. Please, always inspect data dictionary upload. Ensure, data set formatted much information possible. `field.type` can supplied","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/ds2dd_detailed.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract data from stata file for data dictionary — ds2dd_detailed","text":"","code":"## Basic parsing with default options requireNamespace(\"REDCapCAST\") redcapcast_data |> dplyr::select(-dplyr::starts_with(\"redcap_\")) |> ds2dd_detailed() #> $data #> # A tibble: 25 × 24 #> record_id cpr inclusion inclusion_time dob age age_integer sex #> #> 1 1 12034… 2023-03-13 12:38:49 1940-03-12 83.0 83 fema… #> 2 2 01023… 2023-03-01 10:38:57 1934-02-01 89.1 89 male #> 3 2 NA NA NA NA NA NA NA #> 4 2 NA NA NA NA NA NA NA #> 5 3 23015… 2022-03-08 12:01:07 1956-01-23 66.1 66 male #> 6 3 NA NA NA NA NA NA NA #> 7 3 NA NA NA NA NA NA NA #> 8 3 NA NA NA NA NA NA NA #> 9 3 NA NA NA NA NA NA NA #> 10 3 NA NA NA NA NA NA NA #> # ℹ 15 more rows #> # ℹ 16 more variables: cohabitation , hypertension , diabetes , #> # region , baseline_data_start_complete , mrs_assessed , #> # mrs_date , mrs_score , mrs_complete , con_mrs , #> # con_calc , consensus_complete , event_datetime , #> # event_age , event_type , new_event_complete #> #> $meta #> # A tibble: 24 × 18 #> field_name form_name section_header field_type field_label #> #> 1 record_id data NA text record_id #> 2 cpr data NA text cpr #> 3 inclusion data NA text inclusion #> 4 inclusion_time data NA text inclusion_time #> 5 dob data NA text dob #> 6 age data NA text age #> 7 age_integer data NA text age_integer #> 8 sex data NA text sex #> 9 cohabitation data NA text cohabitation #> 10 hypertension data NA text hypertension #> # ℹ 14 more rows #> # ℹ 13 more variables: select_choices_or_calculations , field_note , #> # text_validation_type_or_show_slider_number , #> # text_validation_min , text_validation_max , identifier , #> # branching_logic , required_field , custom_alignment , #> # question_number , matrix_group_name , matrix_ranking , #> # field_annotation #> #> attr(,\"class\") #> [1] \"REDCapCAST\" \"list\" ## Adding a record_id field iris |> ds2dd_detailed(add.auto.id = TRUE) #> $data #> # A tibble: 150 × 6 #> record_id sepal.length sepal.width petal.length petal.width species #> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # ℹ 140 more rows #> #> $meta #> # A tibble: 6 × 18 #> field_name form_name section_header field_type field_label #> #> 1 record_id data NA text record_id #> 2 sepal.length data NA text Sepal.Length #> 3 sepal.width data NA text Sepal.Width #> 4 petal.length data NA text Petal.Length #> 5 petal.width data NA text Petal.Width #> 6 species data NA radio Species #> # ℹ 13 more variables: select_choices_or_calculations , field_note , #> # text_validation_type_or_show_slider_number , #> # text_validation_min , text_validation_max , identifier , #> # branching_logic , required_field , custom_alignment , #> # question_number , matrix_group_name , matrix_ranking , #> # field_annotation #> #> attr(,\"class\") #> [1] \"REDCapCAST\" \"list\" ## Passing form name information to function iris |> ds2dd_detailed( add.auto.id = TRUE, form.name = sample(c(\"b\", \"c\"), size = 6, replace = TRUE, prob = rep(.5, 2)) ) |> purrr::pluck(\"meta\") #> # A tibble: 6 × 18 #> field_name form_name section_header field_type field_label #> #> 1 record_id b NA text record_id #> 2 sepal.length c NA text Sepal.Length #> 3 sepal.width b NA text Sepal.Width #> 4 petal.length c NA text Petal.Length #> 5 petal.width b NA text Petal.Width #> 6 species c NA radio Species #> # ℹ 13 more variables: select_choices_or_calculations , field_note , #> # text_validation_type_or_show_slider_number , #> # text_validation_min , text_validation_max , identifier , #> # branching_logic , required_field , custom_alignment , #> # question_number , matrix_group_name , matrix_ranking , #> # field_annotation mtcars |> ds2dd_detailed(add.auto.id = TRUE) #> $data #> # A tibble: 32 × 12 #> record_id mpg cyl disp hp drat wt qsec vs am gear carb #> #> 1 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 #> 2 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 #> 3 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 #> 4 4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 #> 5 5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 #> 6 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 #> 7 7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 #> 8 8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 #> 9 9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 #> 10 10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 #> # ℹ 22 more rows #> #> $meta #> # A tibble: 12 × 18 #> field_name form_name section_header field_type field_label #> #> 1 record_id data NA text record_id #> 2 mpg data NA text mpg #> 3 cyl data NA text cyl #> 4 disp data NA text disp #> 5 hp data NA text hp #> 6 drat data NA text drat #> 7 wt data NA text wt #> 8 qsec data NA text qsec #> 9 vs data NA text vs #> 10 am data NA text am #> 11 gear data NA text gear #> 12 carb data NA text carb #> # ℹ 13 more variables: select_choices_or_calculations , field_note , #> # text_validation_type_or_show_slider_number , #> # text_validation_min , text_validation_max , identifier , #> # branching_logic , required_field , custom_alignment , #> # question_number , matrix_group_name , matrix_ranking , #> # field_annotation #> #> attr(,\"class\") #> [1] \"REDCapCAST\" \"list\" ## Using column name suffix to carry form name data <- iris |> ds2dd_detailed(add.auto.id = TRUE) |> purrr::pluck(\"data\") names(data) <- glue::glue(\"{sample(x = c('a','b'),size = length(names(data)), replace=TRUE,prob = rep(x=.5,2))}__{names(data)}\") data |> ds2dd_detailed(form.sep = \"__\") #> $data #> # A tibble: 150 × 6 #> record_id sepal.length sepal.width petal.length petal.width species #> #> 1 1 5.1 3.5 1.4 0.2 setosa #> 2 2 4.9 3 1.4 0.2 setosa #> 3 3 4.7 3.2 1.3 0.2 setosa #> 4 4 4.6 3.1 1.5 0.2 setosa #> 5 5 5 3.6 1.4 0.2 setosa #> 6 6 5.4 3.9 1.7 0.4 setosa #> 7 7 4.6 3.4 1.4 0.3 setosa #> 8 8 5 3.4 1.5 0.2 setosa #> 9 9 4.4 2.9 1.4 0.2 setosa #> 10 10 4.9 3.1 1.5 0.1 setosa #> # ℹ 140 more rows #> #> $meta #> # A tibble: 6 × 18 #> field_name form_name section_header field_type field_label #> #> 1 record_id b NA text record_id #> 2 sepal.length a NA text sepal.length #> 3 sepal.width b NA text sepal.width #> 4 petal.length a NA text petal.length #> 5 petal.width b NA text petal.width #> 6 species a NA radio species #> # ℹ 13 more variables: select_choices_or_calculations , field_note , #> # text_validation_type_or_show_slider_number , #> # text_validation_min , text_validation_max , identifier , #> # branching_logic , required_field , custom_alignment , #> # question_number , matrix_group_name , matrix_ranking , #> # field_annotation #> #> attr(,\"class\") #> [1] \"REDCapCAST\" \"list\""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.html","id":null,"dir":"Reference","previous_headings":"","what":"Secure API key storage and data acquisition in one — easy_redcap","title":"Secure API key storage and data acquisition in one — easy_redcap","text":"Secure API key storage data acquisition one","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Secure API key storage and data acquisition in one — easy_redcap","text":"","code":"easy_redcap(project.name, widen.data = TRUE, uri, ...)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Secure API key storage and data acquisition in one — easy_redcap","text":"project.name name current project (key storage key_set, using default keyring) widen.data argument widen exported data uri REDCap database API uri ... arguments passed read_redcap_tables.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Secure API key storage and data acquisition in one — easy_redcap","text":"data.frame list depending widen.data","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/easy_redcap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Secure API key storage and data acquisition in one — easy_redcap","text":"","code":"if (FALSE) { # \\dontrun{ easy_redcap(\"My_new_project\",fields=c(\"record_id\",\"age\",\"hypertension\")) } # }"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.html","id":null,"dir":"Reference","previous_headings":"","what":"Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument","title":"Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument","text":"Metadata can added editing data dictionary project initial design phase. want later add new instruments, function can used create () instrument(s) add project production.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument","text":"","code":"export_redcap_instrument(data, file, force = FALSE, record.id = \"record_id\")"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument","text":"data metadata relevant instrument. `ds2dd_detailed()` file destination file name. force force instrument creation ignore different form names just using first. record.id record id variable name. Default 'record_id'.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument","text":"exports zip-file","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/export_redcap_instrument.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Creates zip-file with necessary content to manually add instrument to database — export_redcap_instrument","text":"","code":"# iris |> # ds2dd_detailed( # add.auto.id = TRUE, # form.name = sample(c(\"b\", \"c\"), size = 6, replace = TRUE, prob = rep(.5, 2)) # ) |> # purrr::pluck(\"meta\") |> # (\\(.x){ # split(.x, .x$form_name) # })() |> # purrr::imap(function(.x, .i){ # export_redcap_instrument(.x,file=here::here(paste0(.i,Sys.Date(),\".zip\"))) # }) # iris |> # ds2dd_detailed( # add.auto.id = TRUE # ) |> # purrr::pluck(\"meta\") |> # export_redcap_instrument(file=here::here(paste0(\"instrument\",Sys.Date(),\".zip\")))"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct2num.html","id":null,"dir":"Reference","previous_headings":"","what":"Allows conversion of factor to numeric values preserving original levels — fct2num","title":"Allows conversion of factor to numeric values preserving original levels — fct2num","text":"Allows conversion factor numeric values preserving original levels","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct2num.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Allows conversion of factor to numeric values preserving original levels — fct2num","text":"","code":"fct2num(data)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct2num.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Allows conversion of factor to numeric values preserving original levels — fct2num","text":"data vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct2num.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Allows conversion of factor to numeric values preserving original levels — fct2num","text":"numeric vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct2num.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Allows conversion of factor to numeric values preserving original levels — fct2num","text":"","code":"c(1, 4, 3, \"A\", 7, 8, 1) |> as_factor() |> fct2num() #> [1] 1 2 3 4 5 6 1 structure(c(1, 2, 3, 2, 10, 9), labels = c(Unknown = 9, Refused = 10), class = \"haven_labelled\" ) |> as_factor() |> fct2num() #> [1] 1 2 3 2 10 9 structure(c(1, 2, 3, 2, 10, 9), labels = c(Unknown = 9, Refused = 10), class = \"labelled\" ) |> as_factor() |> fct2num() #> [1] 1 2 3 2 10 9 structure(c(1, 2, 3, 2, 10, 9), labels = c(Unknown = 9, Refused = 10) ) |> as_factor() |> fct2num() #> [1] 1 2 3 2 NA NA"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.html","id":null,"dir":"Reference","previous_headings":"","what":"Drop unused levels preserving label data — fct_drop","title":"Drop unused levels preserving label data — fct_drop","text":"extends [forcats::fct_drop()] natively work across data.frame replace [base::droplevels()].","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Drop unused levels preserving label data — fct_drop","text":"","code":"fct_drop.data.frame(x, ...)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/fct_drop.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Drop unused levels preserving label data — fct_drop","text":"x Factor drop unused levels ... arguments passed method.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/file_extension.html","id":null,"dir":"Reference","previous_headings":"","what":"DEPRECATED Helper to import files correctly — file_extension","title":"DEPRECATED Helper to import files correctly — file_extension","text":"DEPRECATED Helper import files correctly","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/file_extension.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"DEPRECATED Helper to import files correctly — file_extension","text":"","code":"file_extension(filenames)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/file_extension.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"DEPRECATED Helper to import files correctly — file_extension","text":"filenames file names","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/file_extension.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"DEPRECATED Helper to import files correctly — file_extension","text":"character vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/file_extension.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"DEPRECATED Helper to import files correctly — file_extension","text":"","code":"file_extension(list.files(here::here(\"\"))[[2]])[[1]] #> [1] \"\" file_extension(c(\"file.cd..ks\", \"file\")) #> [1] \"ks\" \"\""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.html","id":null,"dir":"Reference","previous_headings":"","what":"focused_metadata — focused_metadata","title":"focused_metadata — focused_metadata","text":"Extracts limited metadata variables dataset","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"focused_metadata — focused_metadata","text":"","code":"focused_metadata(metadata, vars_in_data)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"focused_metadata — focused_metadata","text":"metadata dataframe containing metadata vars_in_data Vector variable names dataset","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/focused_metadata.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"focused_metadata — focused_metadata","text":"dataframe containing metadata variables dataset","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_redcap_factor.html","id":null,"dir":"Reference","previous_headings":"","what":"Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor","title":"Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor","text":"Applying as_factor data.frame variable, coerce factor.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_redcap_factor.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor","text":"","code":"format_redcap_factor(data, meta)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_redcap_factor.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor","text":"data vector meta vector REDCap choices","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_redcap_factor.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor","text":"vector class \"labelled\" \"labels\" attribute","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_redcap_factor.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Converts REDCap choices to factor levels and stores in labels attribute — format_redcap_factor","text":"","code":"format_redcap_factor(sample(1:3,20,TRUE),\"1, First. | 2, second | 3, THIRD\") #> [1] 1 3 3 2 3 2 3 2 3 2 2 1 3 2 2 3 1 2 1 1 #> attr(,\"labels\") #> First. second THIRD #> \"1\" \"2\" \"3\" #> attr(,\"class\") #> [1] \"labelled\""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.html","id":null,"dir":"Reference","previous_headings":"","what":"Sub-header formatting wrapper — format_subheader","title":"Sub-header formatting wrapper — format_subheader","text":"Sub-header formatting wrapper","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sub-header formatting wrapper — format_subheader","text":"","code":"format_subheader(data, tag = \"h2\")"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sub-header formatting wrapper — format_subheader","text":"data character vector tag character vector length 1","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sub-header formatting wrapper — format_subheader","text":"character vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/format_subheader.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sub-header formatting wrapper — format_subheader","text":"","code":"\"Instrument header\" |> format_subheader() #> Instrument header<\/h2><\/div>"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_api_key.html","id":null,"dir":"Reference","previous_headings":"","what":"Retrieve project API key if stored, if not, set and retrieve — get_api_key","title":"Retrieve project API key if stored, if not, set and retrieve — get_api_key","text":"Attempting make secure API key storage simple, way makes sense. Wrapping key_get key_set using key_list check key storage already.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_api_key.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Retrieve project API key if stored, if not, set and retrieve — get_api_key","text":"","code":"get_api_key(key.name, ...)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_api_key.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Retrieve project API key if stored, if not, set and retrieve — get_api_key","text":"key.name character vector key name ... passed key_set","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_api_key.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Retrieve project API key if stored, if not, set and retrieve — get_api_key","text":"character vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_attr.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract attribute. Returns NA if none — get_attr","title":"Extract attribute. Returns NA if none — get_attr","text":"Extract attribute. Returns NA none","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_attr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract attribute. Returns NA if none — get_attr","text":"","code":"get_attr(data, attr = NULL)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_attr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract attribute. Returns NA if none — get_attr","text":"data vector attr attribute name","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_attr.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract attribute. Returns NA if none — get_attr","text":"character vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_attr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract attribute. Returns NA if none — get_attr","text":"","code":"attr(mtcars$mpg, \"label\") <- \"testing\" do.call(c, sapply(mtcars, get_attr)) #> $mpg.label #> [1] \"testing\" #> if (FALSE) { # \\dontrun{ mtcars |> numchar2fct(numeric.threshold = 6) |> ds2dd_detailed() } # }"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_id_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the id name — get_id_name","title":"Get the id name — get_id_name","text":"Get id name","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_id_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the id name — get_id_name","text":"","code":"get_id_name(data)"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_id_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the id name — get_id_name","text":"data data frame list","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/get_id_name.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the id name — get_id_name","text":"character vector","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only.html","id":null,"dir":"Reference","previous_headings":"","what":"Guess time variables based on naming pattern — guess_time_only","title":"Guess time variables based on naming pattern — guess_time_only","text":"repairing data time variables appended \"1970-01-01\"","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Guess time variables based on naming pattern — guess_time_only","text":"","code":"guess_time_only( data, validate.time = FALSE, time.var.sel.pos = \"[Tt]i[d(me)]\", time.var.sel.neg = \"[Dd]at[eo]\" )"},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Guess time variables based on naming pattern — guess_time_only","text":"data data.frame tibble validate.time Flag validate guessed time columns time.var.sel.pos Positive selection regex string passed `gues_time_only_filter()` sel.pos. time.var.sel.neg Negative selection regex string passed `gues_time_only_filter()` sel.neg.","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Guess time variables based on naming pattern — guess_time_only","text":"data.frame tibble","code":""},{"path":"https://agdamsbo.github.io/REDCapCAST/reference/guess_time_only.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Guess time variables based on naming pattern — guess_time_only","text":"","code":"redcapcast_data |> guess_time_only(validate.time = TRUE) #> $is.POSIX #> # A tibble: 25 × 2 #> inclusion_time event_datetime #> | | | | | |