diff --git a/DESCRIPTION b/DESCRIPTION index f16ec351..b89aff9d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: secuTrialR Type: Package Title: Handling of Data from the Clinical Data Management System 'secuTrial' -Version: 1.0.2 +Version: 1.0.3 Authors@R: c(person(given = "Patrick R.", family = "Wright", diff --git a/NEWS.md b/NEWS.md index 37257e12..594ae604 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# secuTrialR 1.0.1, 1.0.2 +# secuTrialR 1.0.1, 1.0.2, 1.0.3 * adjustments to handle review feedback from CRAN (#190) # secuTrialR 1.0.0 diff --git a/R/asdataframe.R b/R/asdataframe.R index 67f0391b..577c62b3 100644 --- a/R/asdataframe.R +++ b/R/asdataframe.R @@ -1,14 +1,20 @@ #' as.data.frame method for secuTrialdata objects -#' +#' Make the data from the exports more easily accessible by placing them in +#' another environment (e.g. place them in the global environment +#' (\code{.GlobalEnv}) and you can reference them without referring to the +#' \code{secuTrialdata} object anymore. Ie. they become regular \code{data.frame}s). #' @param x \code{secuTrialdata} object -#' @param ... further parameters +#' @param envir environment in which to put the data (e.g. \code{.GlobalEnv}) #' @param data.frames character vector of data.frame names to turn into data.frames #' @param meta logical should metadata be returned #' @param regex regex syntax to remove from names #' @param rep replacement for regex -#' @param envir environment in which to put the data -#' -#' @return each data.frame on the \code{secuTrialdata} object is saved to it's own data.frame in the environment +#' @param ... further parameters +#' @details \code{envir} must be specifically defined. For simplicity, +#' \code{.GlobalEnv} would probably be the easiest (assigning it to another +#' environment would still entail referring to that environment). +#' @return each \code{data.frame} in the \code{secuTrialdata} object is saved to it's +#' own \code{data.frame} in the designated environment #' @export #' #' @examples @@ -18,16 +24,20 @@ #' package = "secuTrialR") #' # load all export data #' sT_export <- read_secuTrial_raw(data_dir = export_location) -#' # add files to global environment -#' as.data.frame(sT_export) -#' # add files to global environment, removing the project name from the file names -#' as.data.frame(sT_export, regex = "ctu05") -as.data.frame.secuTrialdata <- function(x, ..., +#' # add files to a new environment called env1 +#' env1 <- new.env() +#' as.data.frame(sT_export, envir = env1) +#' # add files to a new environment called env2, removing the project name from +#' # the file names +#' env2 <- new.env() +#' as.data.frame(sT_export, regex = "ctu05", envir = env2) +as.data.frame.secuTrialdata <- function(x, + ..., + envir, data.frames = NULL, meta = FALSE, regex = NULL, - rep = "", - envir = .GlobalEnv + rep = "" ) { if (all(!is.character(regex), !is.null(regex))) stop("regex should be either NULL or character") @@ -49,7 +59,7 @@ as.data.frame.secuTrialdata <- function(x, ..., function(orig_name, new_name) { assign(new_name, x[[orig_name]], envir = envir) }, - datanames, datanames2) + datanames, datanames2) ) } diff --git a/README.Rmd b/README.Rmd index 311b1432..60c5798c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -185,13 +185,15 @@ dat <- d %>% `secuTrialR` has a couple of functions to help get to grips with a secuTrial data export. They are intended to be used in an exploratory manner only. #### as.data.frame -Working with a list can be tiresome so `secuTrialR` provides a `as.data.frame` method to save the `data.frames` in the list to an environment of your choice. +Working with a list can be tiresome so `secuTrialR` provides a `as.data.frame` method to save the `data.frames` in the list to an environment of your choice. +As a demonstration, we'll create a new environment (`env`) and create the `data.frame`s in there. In practice, using `.GlobalEnv` would probably be more useful. ```{r} -ls() +env <- new.env() +ls(env) names(ctu05) -as.data.frame(ctu05) -ls() +as.data.frame(ctu05, envir = env) +ls(env) ``` There are also options for selecting specific forms (option `data.frames`), changing names based on regex (options `regex` and `rep`) and specifying whether metadata objects should be returned (option `meta`). @@ -336,6 +338,7 @@ R CMD check secuTrialR_0.9.0.tar.gz ``` ### Versioning and releases + The version number is made up of three digits. The first digit is reserved for major releases which may break backwards compatibility. The second and third digits are used for medium and minor changes respectively. @@ -343,6 +346,14 @@ Versions released on CRAN will be tagged and saved as releases on GitHub. The version released on CRAN is regarded as the stable version while the master branch on GitHub is regarded as the current development version. +#### Release checklist + +Compile/Update: +* README.Rmd +* vignette +* pkgdown page +* NEWS.md + ### Guidelines for contributors Requests for new features and bug fixes should first be documented as an [Issue](https://github.com/SwissClinicalTrialOrganisation/secuTrialR/issues) on GitHub. diff --git a/README.md b/README.md index d9d8a488..520de142 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -# secuTrialR [![](https://img.shields.io/badge/version-1.0.2-blue.svg)](https://github.com/SwissClinicalTrialOrganisation/secuTrialR) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/SwissClinicalTrialOrganisation/secuTrialR?branch=master&svg=true)](https://ci.appveyor.com/project/SwissClinicalTrialOrganisation/secuTrialR) [![travis](https://api.travis-ci.com/SwissClinicalTrialOrganisation/secuTrialR.svg?branch=master)](https://travis-ci.com/github/SwissClinicalTrialOrganisation/secuTrialR) [![codecov](https://codecov.io/github/SwissClinicalTrialOrganisation/secuTrialR/branch/master/graphs/badge.svg)](https://codecov.io/github/SwissClinicalTrialOrganisation/secuTrialR) +# secuTrialR [![](https://img.shields.io/badge/version-1.0.3-blue.svg)](https://github.com/SwissClinicalTrialOrganisation/secuTrialR) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/SwissClinicalTrialOrganisation/secuTrialR?branch=master&svg=true)](https://ci.appveyor.com/project/SwissClinicalTrialOrganisation/secuTrialR) [![travis](https://api.travis-ci.com/SwissClinicalTrialOrganisation/secuTrialR.svg?branch=master)](https://travis-ci.com/github/SwissClinicalTrialOrganisation/secuTrialR) [![codecov](https://codecov.io/github/SwissClinicalTrialOrganisation/secuTrialR/branch/master/graphs/badge.svg)](https://codecov.io/github/SwissClinicalTrialOrganisation/secuTrialR) An R package to handle data from the clinical data management system (CDMS) [secuTrial](https://www.secutrial.com/en/). @@ -284,16 +284,17 @@ dat <- d %>% `secuTrialR` has a couple of functions to help get to grips with a secuTrial data export. They are intended to be used in an exploratory manner only. #### as.data.frame -Working with a list can be tiresome so `secuTrialR` provides a `as.data.frame` method to save the `data.frames` in the list to an environment of your choice. +Working with a list can be tiresome so `secuTrialR` provides a `as.data.frame` method to save the `data.frames` in the list to an environment of your choice. +As a demonstration, we'll create a new environment (`env`) and create the `data.frame`s in there. In practice, using `.GlobalEnv` would probably be more useful. ```r -ls() +env <- new.env() +ls(env) ``` ``` -## [1] "bmd_export" "ctu05" "ctu05_raw" "dates" -## [5] "export_location" "factors" "labelled" "labs" +## character(0) ``` ```r @@ -320,8 +321,8 @@ names(ctu05) ``` ```r -as.data.frame(ctu05) -ls() +as.data.frame(ctu05, envir = env) +ls(env) ``` ``` @@ -330,14 +331,10 @@ ls() ## [5] "atmnpctu05allmedi" "atmnpctu05baseline" ## [7] "atmnpctu05outcome" "atmnpctu05sae" ## [9] "atmnpctu05studyterminat" "atmnpctu05treatment" -## [11] "bmd_export" "ctu05" -## [13] "ctu05_raw" "ctu05ae" -## [15] "ctu05allmedi" "ctu05baseline" -## [17] "ctu05outcome" "ctu05sae" -## [19] "ctu05studyterminat" "ctu05treatment" -## [21] "dates" "emnpctu05surgeries" -## [23] "export_location" "factors" -## [25] "labelled" "labs" +## [11] "ctu05ae" "ctu05allmedi" +## [13] "ctu05baseline" "ctu05outcome" +## [15] "ctu05sae" "ctu05studyterminat" +## [17] "ctu05treatment" "emnpctu05surgeries" ``` There are also options for selecting specific forms (option `data.frames`), changing names based on regex (options `regex` and `rep`) and specifying whether metadata objects should be returned (option `meta`). @@ -580,6 +577,7 @@ R CMD check secuTrialR_0.9.0.tar.gz ``` ### Versioning and releases + The version number is made up of three digits. The first digit is reserved for major releases which may break backwards compatibility. The second and third digits are used for medium and minor changes respectively. @@ -587,6 +585,14 @@ Versions released on CRAN will be tagged and saved as releases on GitHub. The version released on CRAN is regarded as the stable version while the master branch on GitHub is regarded as the current development version. +#### Release checklist + +Compile/Update: +* README.Rmd +* vignette +* pkgdown page +* NEWS.md + ### Guidelines for contributors Requests for new features and bug fixes should first be documented as an [Issue](https://github.com/SwissClinicalTrialOrganisation/secuTrialR/issues) on GitHub. diff --git a/docs/404.html b/docs/404.html index 3146fd67..5be56508 100644 --- a/docs/404.html +++ b/docs/404.html @@ -71,7 +71,7 @@
diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 867afb26..f2551aac 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -71,7 +71,7 @@ diff --git a/docs/LICENSE.html b/docs/LICENSE.html index b52c962d..c2267166 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -71,7 +71,7 @@ diff --git a/docs/articles/index.html b/docs/articles/index.html index ad0e31f1..8320e89f 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -71,7 +71,7 @@ diff --git a/docs/articles/secuTrialR-package-vignette.html b/docs/articles/secuTrialR-package-vignette.html index da8d6225..c63c6e96 100644 --- a/docs/articles/secuTrialR-package-vignette.html +++ b/docs/articles/secuTrialR-package-vignette.html @@ -31,7 +31,7 @@ @@ -78,7 +78,7 @@secuTrialR-package-vignette.Rmd