preparing for next version

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-10-24 11:41:48 +02:00
commit 28beea676c
No known key found for this signature in database
7 changed files with 109 additions and 28 deletions

View file

@ -1,8 +1,8 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/create_instrument_meta.R
% Please edit documentation in R/export_redcap_instrument.R
\name{create_instrument_meta}
\alias{create_instrument_meta}
\title{Create zips file with necessary content based on data set}
\title{DEPRICATED Create zips file with necessary content based on data set}
\usage{
create_instrument_meta(data, dir = here::here(""), record.id = TRUE)
}
@ -21,22 +21,29 @@ list
}
\description{
Metadata can be added by editing the data dictionary of a project in the
initial design phase. If you want to later add new instruments, this can be
used to add instrument(s) to a project in production.
initial design phase. If you want to later add new instruments, this
function can be used to create (an) instrument(s) to add to a project in
production.
}
\examples{
data <- iris |>
ds2dd_detailed(add.auto.id = TRUE,
form.name=sample(c("b","c"),size = 6,replace = TRUE,prob=rep(.5,2))) |>
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")
names(data) <- glue::glue("{sample(x = c('a','b'),size = length(names(data)),
replace=TRUE,prob = rep(x=.5,2))}__{names(data)}")
data <- data |> ds2dd_detailed(form.sep="__")
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)

View file

@ -34,7 +34,7 @@ ncol(data). Default is NULL and "data" is used.}
\item{form.sep}{If supplied dataset has form names as suffix or prefix to the
column/variable names, the seperator can be specified. If supplied, the
form.sep is ignored. Default is NULL.}
form.name is ignored. Default is NULL.}
\item{form.prefix}{Flag to set if form is prefix (TRUE) or suffix (FALSE) to
the column names. Assumes all columns have pre- or suffix if specified.}
@ -87,11 +87,17 @@ data <- REDCapCAST::redcapcast_data
data |> ds2dd_detailed(validate.time = TRUE)
data |> ds2dd_detailed()
iris |> ds2dd_detailed(add.auto.id = TRUE)
iris |>
ds2dd_detailed(
add.auto.id = TRUE,
form.name = sample(c("b", "c"), size = 6, replace = TRUE, prob = rep(.5, 2))
) |>
purrr::pluck("meta")
mtcars |> ds2dd_detailed(add.auto.id = TRUE)
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 |> ds2dd_detailed(form.sep = "__")
}