generated from pharmaverse/admiraltemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from atorus-research/gh_issue_43
Gh issue 43
- Loading branch information
Showing
27 changed files
with
453 additions
and
846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#' Create the data metadata container for a Dataset JSON object | ||
#' | ||
#' @param study Study OID value | ||
#' @param metadata_version Metadata version OID value | ||
#' @param metadata_ref Metadata reference (i.e. path to Define.xml) | ||
#' | ||
#' @return data_metadata object | ||
#' @export | ||
#' | ||
#' @examples | ||
#' # Create object directly | ||
#' data_meta <- data_metadata( | ||
#' study = "SOMESTUDY", | ||
#' metadata_version = "MDV.MSGv2.0.SDTMIG.3.3.SDTM.1.7", | ||
#' metadata_ref = "some/define.xml" | ||
#' ) | ||
#' | ||
#' # Use setter functions | ||
#' data_meta <- data_metadata() | ||
#' data_meta_updated <- set_metadata_ref(data_meta, "some/define.xml") | ||
#' data_meta_updated <- set_metadata_version(data_meta_updated, "MDV.MSGv2.0.SDTMIG.3.3.SDTM.1.7") | ||
#' data_meta_updated <- set_study_oid(data_meta_updated, "SOMESTUDY") | ||
#' | ||
data_metadata <- function(study = NULL, metadata_version = NULL, metadata_ref = NULL) { | ||
|
||
x <- list( | ||
studyOID = study, | ||
metaDataVersionOID = metadata_version, | ||
metaDataRef = metadata_ref, | ||
itemGroupData = NULL | ||
) | ||
|
||
structure( | ||
x, | ||
class = c("data_metadata", "list") | ||
) | ||
} | ||
|
||
#' Set data metadata parameters | ||
#' | ||
#' This set of functions | ||
#' @param x data metadata or datasetjson object | ||
#' @param study Study OID value | ||
#' @param ... Additional parameters | ||
#' | ||
#' @return A datasetjson or data_metadata object | ||
#' @export | ||
#' | ||
#' @family Data metadata setters | ||
#' @rdname data_metadata_setters | ||
#' | ||
#' @examples | ||
#' data_meta <- data_metadata() | ||
#' data_meta_updated <- set_metadata_ref(data_meta, "some/define.xml") | ||
#' data_meta_updated <- set_metadata_version(data_meta_updated, "MDV.MSGv2.0.SDTMIG.3.3.SDTM.1.7") | ||
#' data_meta_updated <- set_study_oid(data_meta_updated, "SOMESTUDY") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This file contains several helpers for reading and writing date / datetime | ||
# columns from a Dataset JSON file | ||
|
||
#' Get the column classes off a data frame | ||
#' | ||
#' @param x A data.frame | ||
#' | ||
#' @return Named character vector of columns and types | ||
#' @noRd | ||
get_column_classes <- function(x) { | ||
vapply(x, function(X) class(X)[1], FUN.VALUE=character(1)) | ||
} | ||
|
||
#' Get the columns with a class of Date from a data.frame | ||
#' | ||
#' @param x A data.frame | ||
#' | ||
#' @return A data.frame | ||
#' @noRd | ||
get_date_cols <- function(x) { | ||
x[get_column_classes(x) == "Date"] | ||
} | ||
|
||
#' Get the columns with a class of POSIXct from a data.frame | ||
#' | ||
#' @param x A data.frame | ||
#' | ||
#' @return A data.frame | ||
#' @noRd | ||
get_datetime_cols <- function(x) { | ||
x[get_column_classes(x) == "POSIXct"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.