Skip to content

Commit

Permalink
docs: #91 including data option. updating vignettes
Browse files Browse the repository at this point in the history
  • Loading branch information
bms63 committed Jan 29, 2024
1 parent 4023016 commit 9ac78b0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions R/length.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 78 in R/length.R

View workflow job for this annotation

GitHub Actions / lint

file=R/length.R,line=78,col=5,[commented_code_linter] Commented code should be removed.
if (!missing(metacore)) {
lifecycle::deprecate_stop(
when = "0.3.1.9005",
Expand Down
2 changes: 1 addition & 1 deletion man/xportr_length.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vignettes/deepdive.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>%
Expand All @@ -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() %>%
Expand Down Expand Up @@ -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.
Expand All @@ -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")
```


Expand Down Expand Up @@ -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() %>%
Expand Down
2 changes: 1 addition & 1 deletion vignettes/xportr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>%
Expand Down

0 comments on commit 9ac78b0

Please sign in to comment.