restructuring

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-26 14:46:22 +01:00
commit 4ad21c7f57
No known key found for this signature in database
19 changed files with 432 additions and 80 deletions

View file

@ -26,6 +26,7 @@ function can be used to create (an) instrument(s) to add to a project in
production.
}
\examples{
\dontrun{
data <- iris |>
ds2dd_detailed(
add.auto.id = TRUE,
@ -44,7 +45,8 @@ 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)
data |>
purrr::pluck("meta") |>
create_instrument_meta(record.id = FALSE)
}
}

View file

@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ds2dd.R
% Please edit documentation in R/ds2dd_detailed.R
\name{ds2dd}
\alias{ds2dd}
\title{(DEPRECATED) Data set to data dictionary function}
@ -11,7 +11,7 @@ ds2dd(
field.type = "text",
field.label = NULL,
include.column.names = FALSE,
metadata = metadata_names
metadata = REDCapCAST::redcap_meta_default()
)
}
\arguments{
@ -34,7 +34,7 @@ names.}
column names for original data set for upload.}
\item{metadata}{Metadata column names. Default is the included
REDCapCAST::metadata_names.}
REDCapCAST::redcap_meta_default.}
}
\value{
data.frame or list of data.frame and vector

View file

@ -15,7 +15,7 @@ ds2dd_detailed(
field.label = NULL,
field.label.attr = "label",
field.validation = NULL,
metadata = names(REDCapCAST::redcapcast_meta),
metadata = REDCapCAST::redcap_meta_default(),
convert.logicals = TRUE
)
}
@ -55,7 +55,7 @@ or attribute `factor.labels.attr` for haven_labelled data set (imported .dta
file with `haven::read_dta()`).}
\item{metadata}{redcap metadata headings. Default is
REDCapCAST:::metadata_names.}
REDCapCAST::redcap_meta_default().}
\item{convert.logicals}{convert logicals to factor. Default is TRUE.}
}
@ -76,7 +76,8 @@ Ensure, that the data set is formatted with as much information as possible.
}
\examples{
## Basic parsing with default options
REDCapCAST::redcapcast_data |>
requireNamespace("REDCapCAST")
redcapcast_data |>
dplyr::select(-dplyr::starts_with("redcap_")) |>
ds2dd_detailed()

View file

@ -27,7 +27,7 @@ function can be used to create (an) instrument(s) to add to a project in
production.
}
\examples{
#iris |>
# iris |>
# ds2dd_detailed(
# add.auto.id = TRUE,
# form.name = sample(c("b", "c"), size = 6, replace = TRUE, prob = rep(.5, 2))
@ -40,7 +40,7 @@ production.
# export_redcap_instrument(.x,file=here::here(paste0(.i,Sys.Date(),".zip")))
# })
#iris |>
# iris |>
# ds2dd_detailed(
# add.auto.id = TRUE
# ) |>

View file

@ -41,7 +41,7 @@ structure(c(1, 2, 3, 2, 10, 9),
# as_factor() |>
# fct2num()
v <- sample(6:19,20,TRUE) |> factor()
v <- sample(6:19, 20, TRUE) |> factor()
dput(v)
named_levels(v)
fct2num(v)

View file

@ -16,7 +16,9 @@ logical
Test if vector can be interpreted as roman numerals
}
\examples{
sample(1:100,10) |> as.roman() |> possibly_roman()
sample(c(TRUE,FALSE),10,TRUE)|> possibly_roman()
rep(NA,10)|> possibly_roman()
sample(1:100, 10) |>
as.roman() |>
possibly_roman()
sample(c(TRUE, FALSE), 10, TRUE) |> possibly_roman()
rep(NA, 10) |> possibly_roman()
}

View file

@ -0,0 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ds2dd_detailed.R
\name{redcap_meta_default}
\alias{redcap_meta_default}
\title{Default column names of a REDCap data dictionary}
\usage{
redcap_meta_default(...)
}
\arguments{
\item{...}{ignored for now}
}
\value{
character vector
}
\description{
Default column names of a REDCap data dictionary
}
\examples{
dput(redcap_meta_default())
}

View file

@ -31,6 +31,6 @@ A data frame with 22 variables:
data(redcapcast_meta)
}
\description{
This metadata dataset from a REDCap database is for demonstrational purposes.
This metadata dataset from a REDCap database is for demonstration purposes.
}
\keyword{datasets}