mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 05:07:30 +02:00
major overhaul with new functions. docs are lacking
This commit is contained in:
parent
1fd3911974
commit
04f5bec85c
28 changed files with 874 additions and 81 deletions
31
man/case_match_regex_list.Rd
Normal file
31
man/case_match_regex_list.Rd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/doc2dd.R
|
||||
\name{case_match_regex_list}
|
||||
\alias{case_match_regex_list}
|
||||
\title{List-base regex case_when}
|
||||
\usage{
|
||||
case_match_regex_list(data, match.list, .default = NA)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{vector}
|
||||
|
||||
\item{match.list}{list of case matches}
|
||||
|
||||
\item{.default}{Default value for non-matches. Default is NA.}
|
||||
}
|
||||
\value{
|
||||
vector
|
||||
}
|
||||
\description{
|
||||
Mimics case_when for list of regex patterns and values. Used for date/time
|
||||
validation generation from name vector. Like case_when, the matches are in
|
||||
order of priority.
|
||||
Primarily used in REDCapCAST to do data type coding from systematic variable
|
||||
naming.
|
||||
}
|
||||
\examples{
|
||||
case_match_regex_list(
|
||||
c("test_date", "test_time", "test_tida", "test_tid"),
|
||||
list(date_dmy = "_dat[eo]$", time_hh_mm_ss = "_ti[md]e?$")
|
||||
)
|
||||
}
|
||||
26
man/char2choice.Rd
Normal file
26
man/char2choice.Rd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/doc2dd.R
|
||||
\name{char2choice}
|
||||
\alias{char2choice}
|
||||
\title{Simple function to generate REDCap choices from character vector}
|
||||
\usage{
|
||||
char2choice(data, char.split = "/", raw = NULL, .default = NA)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{vector}
|
||||
|
||||
\item{char.split}{splitting character(s)}
|
||||
|
||||
\item{raw}{specific values. Can be used for options of same length.}
|
||||
|
||||
\item{.default}{default value for missing. Default is NA.}
|
||||
}
|
||||
\value{
|
||||
vector
|
||||
}
|
||||
\description{
|
||||
Simple function to generate REDCap choices from character vector
|
||||
}
|
||||
\examples{
|
||||
char2choice(c("yes/no"," yep. / nope ","",NA,"what"),.default=NA)
|
||||
}
|
||||
35
man/char2cond.Rd
Normal file
35
man/char2cond.Rd
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/doc2dd.R
|
||||
\name{char2cond}
|
||||
\alias{char2cond}
|
||||
\title{Simple function to generate REDCap branching logic from character vector}
|
||||
\usage{
|
||||
char2cond(
|
||||
data,
|
||||
minor.split = ",",
|
||||
major.split = ";",
|
||||
major.sep = " or ",
|
||||
.default = NA
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{vector}
|
||||
|
||||
\item{minor.split}{minor split}
|
||||
|
||||
\item{major.split}{major split}
|
||||
|
||||
\item{major.sep}{argument separation. Default is " or ".}
|
||||
|
||||
\item{.default}{default value for missing. Default is NA.}
|
||||
}
|
||||
\value{
|
||||
vector
|
||||
}
|
||||
\description{
|
||||
Simple function to generate REDCap branching logic from character vector
|
||||
}
|
||||
\examples{
|
||||
#data <- dd_inst$betingelse
|
||||
#c("Extubation_novent, 2; Pacu_delay, 1") |> char2cond()
|
||||
}
|
||||
24
man/create_html_table.Rd
Normal file
24
man/create_html_table.Rd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/html_styling.R
|
||||
\name{create_html_table}
|
||||
\alias{create_html_table}
|
||||
\title{Create two-column HTML table for data piping in REDCap instruments}
|
||||
\usage{
|
||||
create_html_table(text, variable)
|
||||
}
|
||||
\arguments{
|
||||
\item{text}{descriptive text}
|
||||
|
||||
\item{variable}{variable to pipe}
|
||||
}
|
||||
\value{
|
||||
character vector
|
||||
}
|
||||
\description{
|
||||
Create two-column HTML table for data piping in REDCap instruments
|
||||
}
|
||||
\examples{
|
||||
create_html_table(text = "Patient ID", variable = c("[cpr]"))
|
||||
create_html_table(text = paste("assessor", 1:2, sep = "_"), variable = c("[cpr]"))
|
||||
# create_html_table(text = c("CPR nummer","Word"), variable = c("[cpr][1]", "[cpr][2]", "[test]"))
|
||||
}
|
||||
80
man/doc2dd.Rd
Normal file
80
man/doc2dd.Rd
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/doc2dd.R
|
||||
\name{doc2dd}
|
||||
\alias{doc2dd}
|
||||
\title{Doc table to data dictionary - EARLY, DOCS MISSING}
|
||||
\usage{
|
||||
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
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{tibble or data.frame with all variable names in one column}
|
||||
|
||||
\item{instrument.name}{character vector length one. Instrument name.}
|
||||
|
||||
\item{col.variables}{variable names column (default = 1), allows dplyr
|
||||
subsetting}
|
||||
|
||||
\item{list.datetime.format}{formatting for date/time detection.
|
||||
See `case_match_regex_list()`}
|
||||
|
||||
\item{col.description}{descriptions column, allows dplyr
|
||||
subsetting. If empty, variable names will be used.}
|
||||
|
||||
\item{col.condition}{conditions for branching column, allows dplyr
|
||||
subsetting. See `char2cond()`.}
|
||||
|
||||
\item{col.subheader}{sub-header column, allows dplyr subsetting.
|
||||
See `format_subheader()`.}
|
||||
|
||||
\item{subheader.tag}{formatting tag. Default is "h2"}
|
||||
|
||||
\item{condition.minor.sep}{condition split minor. See `char2cond()`.
|
||||
Default is ",".}
|
||||
|
||||
\item{condition.major.sep}{condition split major. See `char2cond()`.
|
||||
Default is ";".}
|
||||
|
||||
\item{col.calculation}{calculations column. Has to be written exact.
|
||||
Character vector.}
|
||||
|
||||
\item{col.choices}{choices column. See `char2choice()`.}
|
||||
|
||||
\item{choices.char.sep}{choices split. See `char2choice()`. Default is "/".}
|
||||
|
||||
\item{missing.default}{value for missing fields. Default is NA.}
|
||||
}
|
||||
\value{
|
||||
tibble or data.frame (same as data)
|
||||
}
|
||||
\description{
|
||||
Works well with `project.aid::docx2list()`.
|
||||
Allows defining a database in a text document (see provided template) for
|
||||
an easier to use data base creation. This approach allows easier
|
||||
collaboration when defining the database. The generic case is a data frame
|
||||
with variable names as values in a column. This is a format like the REDCap
|
||||
data dictionary, but gives a few options for formatting.
|
||||
}
|
||||
\examples{
|
||||
# data <- dd_inst
|
||||
# data |> doc2dd(instrument.name = "evt",
|
||||
# col.description = 3,
|
||||
# col.condition = 4,
|
||||
# col.subheader = 2,
|
||||
# col.calculation = 5,
|
||||
# col.choices = 6)
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/utils.r
|
||||
% Please edit documentation in R/shiny_cast.R
|
||||
\name{file_extension}
|
||||
\alias{file_extension}
|
||||
\title{Helper to import files correctly}
|
||||
|
|
|
|||
22
man/format_subheader.Rd
Normal file
22
man/format_subheader.Rd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/html_styling.R
|
||||
\name{format_subheader}
|
||||
\alias{format_subheader}
|
||||
\title{Sub-header formatting wrapper}
|
||||
\usage{
|
||||
format_subheader(data, tag = "h2")
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{character vector}
|
||||
|
||||
\item{tag}{character vector length 1}
|
||||
}
|
||||
\value{
|
||||
character vector
|
||||
}
|
||||
\description{
|
||||
Sub-header formatting wrapper
|
||||
}
|
||||
\examples{
|
||||
"Instrument header" |> format_subheader()
|
||||
}
|
||||
25
man/html_tag_wrap.Rd
Normal file
25
man/html_tag_wrap.Rd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/html_styling.R
|
||||
\name{html_tag_wrap}
|
||||
\alias{html_tag_wrap}
|
||||
\title{Simple html tag wrapping for REDCap text formatting}
|
||||
\usage{
|
||||
html_tag_wrap(data, tag = "h2", extra = NULL)
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{character vector}
|
||||
|
||||
\item{tag}{character vector length 1}
|
||||
|
||||
\item{extra}{character vector}
|
||||
}
|
||||
\value{
|
||||
character vector
|
||||
}
|
||||
\description{
|
||||
Simple html tag wrapping for REDCap text formatting
|
||||
}
|
||||
\examples{
|
||||
html_tag_wrap("Titel", tag = "div", extra = 'class="rich-text-field-label"')
|
||||
html_tag_wrap("Titel", tag = "h2")
|
||||
}
|
||||
19
man/is_missing.Rd
Normal file
19
man/is_missing.Rd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/doc2dd.R
|
||||
\name{is_missing}
|
||||
\alias{is_missing}
|
||||
\title{Multi missing check}
|
||||
\usage{
|
||||
is_missing(data, nas = c("", "NA"))
|
||||
}
|
||||
\arguments{
|
||||
\item{data}{character vector}
|
||||
|
||||
\item{nas}{character vector of strings considered as NA}
|
||||
}
|
||||
\value{
|
||||
logical vector
|
||||
}
|
||||
\description{
|
||||
Multi missing check
|
||||
}
|
||||
17
man/process_user_input.Rd
Normal file
17
man/process_user_input.Rd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/process_user_input.r
|
||||
\name{process_user_input}
|
||||
\alias{process_user_input}
|
||||
\title{User input processing}
|
||||
\usage{
|
||||
process_user_input(x)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{input}
|
||||
}
|
||||
\value{
|
||||
processed input
|
||||
}
|
||||
\description{
|
||||
User input processing
|
||||
}
|
||||
19
man/process_user_input.character.Rd
Normal file
19
man/process_user_input.character.Rd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/process_user_input.r
|
||||
\name{process_user_input.character}
|
||||
\alias{process_user_input.character}
|
||||
\title{User input processing character}
|
||||
\usage{
|
||||
\method{process_user_input}{character}(x, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{input}
|
||||
|
||||
\item{...}{ignored}
|
||||
}
|
||||
\value{
|
||||
processed input
|
||||
}
|
||||
\description{
|
||||
User input processing character
|
||||
}
|
||||
19
man/process_user_input.data.frame.Rd
Normal file
19
man/process_user_input.data.frame.Rd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/process_user_input.r
|
||||
\name{process_user_input.data.frame}
|
||||
\alias{process_user_input.data.frame}
|
||||
\title{User input processing data.frame}
|
||||
\usage{
|
||||
\method{process_user_input}{data.frame}(x, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{input}
|
||||
|
||||
\item{...}{ignored}
|
||||
}
|
||||
\value{
|
||||
processed input
|
||||
}
|
||||
\description{
|
||||
User input processing data.frame
|
||||
}
|
||||
19
man/process_user_input.default.Rd
Normal file
19
man/process_user_input.default.Rd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/process_user_input.r
|
||||
\name{process_user_input.default}
|
||||
\alias{process_user_input.default}
|
||||
\title{User input processing default}
|
||||
\usage{
|
||||
\method{process_user_input}{default}(x, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{input}
|
||||
|
||||
\item{...}{ignored}
|
||||
}
|
||||
\value{
|
||||
processed input
|
||||
}
|
||||
\description{
|
||||
User input processing default
|
||||
}
|
||||
19
man/process_user_input.response.Rd
Normal file
19
man/process_user_input.response.Rd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/process_user_input.r
|
||||
\name{process_user_input.response}
|
||||
\alias{process_user_input.response}
|
||||
\title{User input processing response}
|
||||
\usage{
|
||||
\method{process_user_input}{response}(x, ...)
|
||||
}
|
||||
\arguments{
|
||||
\item{x}{input}
|
||||
|
||||
\item{...}{ignored}
|
||||
}
|
||||
\value{
|
||||
processed input
|
||||
}
|
||||
\description{
|
||||
User input processing response
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/utils.r
|
||||
% Please edit documentation in R/shiny_cast.R
|
||||
\name{read_input}
|
||||
\alias{read_input}
|
||||
\title{Flexible file import based on extension}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue