From 9ac78b029e09198f0168aedf9112d617c59f538b Mon Sep 17 00:00:00 2001 From: bs832471 Date: Mon, 29 Jan 2024 18:52:46 +0000 Subject: [PATCH] docs: #91 including data option. updating vignettes --- R/length.R | 4 ++-- man/xportr_length.Rd | 2 +- vignettes/deepdive.Rmd | 10 +++++----- vignettes/xportr.Rmd | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/R/length.R b/R/length.R index 4ed30c7e..d7cf31a5 100644 --- a/R/length.R +++ b/R/length.R @@ -72,10 +72,10 @@ xportr_length <- function(.df, metadata = NULL, domain = NULL, - length = "metadata", + length = c("metadata", "data"), verbose = NULL, metacore = deprecated()) { - length <- match.arg(length) + # length <- match.arg(length) if (!missing(metacore)) { lifecycle::deprecate_stop( when = "0.3.1.9005", diff --git a/man/xportr_length.Rd b/man/xportr_length.Rd index dc052d2a..8a5f0d18 100644 --- a/man/xportr_length.Rd +++ b/man/xportr_length.Rd @@ -8,7 +8,7 @@ xportr_length( .df, metadata = NULL, domain = NULL, - length = "metadata", + length = c("metadata", "data"), verbose = NULL, metacore = deprecated() ) diff --git a/vignettes/deepdive.Rmd b/vignettes/deepdive.Rmd index fc9f601d..ae0c070a 100644 --- a/vignettes/deepdive.Rmd +++ b/vignettes/deepdive.Rmd @@ -179,7 +179,7 @@ Each of the core `{xportr}` functions requires several inputs: A valid dataframe ```{r, eval = FALSE} adsl %>% xportr_type(var_spec, "ADSL", "message") %>% - xportr_length(var_spec, "ADSL", "message") %>% + xportr_length(var_spec, "ADSL", "message", length = "metadata") %>% xportr_label(var_spec, "ADSL", "message") %>% xportr_order(var_spec, "ADSL", "message") %>% xportr_format(var_spec, "ADSL") %>% @@ -194,7 +194,7 @@ To help reduce these repetitive calls, we have created `xportr_metadata()`. A us adsl %>% xportr_metadata(var_spec, "ADSL") %>% xportr_type() %>% - xportr_length() %>% + xportr_length(length = "metadata") %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% @@ -310,7 +310,7 @@ str(adsl) ``` ```{r, echo = TRUE} -adsl_length <- xportr_length(.df = adsl, metadata = var_spec, domain = "ADSL", verbose = "warn") +adsl_length <- xportr_length(.df = adsl, metadata = var_spec, domain = "ADSL", verbose = "warn", length = "metadata") ``` Using `xportr_length()` with `verbose = "warn"` we can apply the length column to all the columns in the dataset. The function detects that two variables, `TRTDUR` and `DCREASCD` are missing from the metadata file. Note that the variables have slight misspellings in the dataset and metadata, which is a great catch! However, lengths are still applied with TRTDUR being give a length of 8 and DCREASCD a length of 200. @@ -325,7 +325,7 @@ str(adsl_length) Just like we did for `xportr_type()`, setting `verbose = "stop"` immediately stops R from processing the lengths. Here the function detects the missing variables and will not apply any lengths to the dataset until corrective action is applied. ```{r, echo = TRUE, error = TRUE} -adsl_length <- xportr_length(.df = adsl, metadata = var_spec, domain = "ADSL", verbose = "stop") +adsl_length <- xportr_length(.df = adsl, metadata = var_spec, domain = "ADSL", verbose = "stop", length = "metadata") ``` @@ -426,7 +426,7 @@ It is also note worthy that you can set the dataset label using the `xportr_df_l adsl %>% xportr_metadata(var_spec, "ADSL") %>% xportr_type() %>% - xportr_length() %>% + xportr_length(length = "metadata") %>% xportr_label() %>% xportr_order() %>% xportr_format() %>% diff --git a/vignettes/xportr.Rmd b/vignettes/xportr.Rmd index 2e39f386..53331e9f 100644 --- a/vignettes/xportr.Rmd +++ b/vignettes/xportr.Rmd @@ -274,7 +274,7 @@ Finally, we arrive at exporting the R data frame object as a `xpt` file with `xp ```{r} adsl %>% xportr_type(var_spec, "ADSL", "message") %>% - xportr_length(var_spec, "ADSL", "message") %>% + xportr_length(var_spec, "ADSL", "message", length = "metadata") %>% xportr_label(var_spec, "ADSL", "message") %>% xportr_order(var_spec, "ADSL", "message") %>% xportr_format(var_spec, "ADSL") %>%