ds2dd bug fixed and new param to specify metadata

This commit is contained in:
Andreas Gammelgaard Damsbo 2023-07-03 12:00:36 +02:00
parent 55679c7845
commit fed6711990
4 changed files with 18 additions and 5 deletions

View File

@ -1,6 +1,6 @@
Package: stRoke
Title: Clinical Stroke Research
Version: 23.6.2
Version: 23.6.3
Authors@R:
person("Andreas Gammelgaard", "Damsbo", , "agdamsbo@clin.au.dk", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7559-1154"))

View File

@ -1,3 +1,9 @@
# stRoke 23.6.3
### Bug
* Fixed `ds2dd()` bug after first practical implementation.
# stRoke 23.6.2
### Functions:

View File

@ -13,6 +13,8 @@ utils::globalVariables(c("metadata_names"))
#' names.
#' @param include.column.names Flag to give detailed output including new
#' column names for original data set for upload.
#' @param metadata Metadata dataframe. Default is the included
#' stRoke::metadata_names.
#'
#' @return data.frame or list of data.frame and vector
#' @export
@ -27,9 +29,10 @@ ds2dd <-
form.name = "basis",
field.type = "text",
field.label = NULL,
include.column.names = FALSE) {
dd <- data.frame(matrix(ncol = length(metadata_names), nrow = ncol(ds)))
colnames(dd) <- metadata_names
include.column.names = FALSE,
metadata = stRoke::metadata_names) {
dd <- data.frame(matrix(ncol = length(metadata), nrow = ncol(ds)))
colnames(dd) <- metadata
if (is.character(record.id) & !record.id %in% colnames(ds)) {
stop("Provided record.id is not a variable name in provided data set.")

View File

@ -10,7 +10,8 @@ ds2dd(
form.name = "basis",
field.type = "text",
field.label = NULL,
include.column.names = FALSE
include.column.names = FALSE,
metadata = stRoke::metadata_names
)
}
\arguments{
@ -31,6 +32,9 @@ names.}
\item{include.column.names}{Flag to give detailed output including new
column names for original data set for upload.}
\item{metadata}{Metadata dataframe. Default is the included
stRoke::metadata_names.}
}
\value{
data.frame or list of data.frame and vector