Skip to content

Commit

Permalink
docs: #84 options verbose section
Browse files Browse the repository at this point in the history
  • Loading branch information
bms63 committed Jun 15, 2023
1 parent 0a0253e commit ead17a8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
22 changes: 22 additions & 0 deletions vignettes/deepdive.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,28 @@ options(
)
```

## Are we being too verbose?

One final note on `options()`. 4 of the core `{xportr}` functions have the ability to set messaging as `"none", "message", "warn", "stop"`. Setting each of these in all your calls can be a bit repetitive. You can use `options()` to set these at a higher level and avoid this repitition.

```{r, eval = FALSE}
# Default
options(
xportr.format_verbose = "none",
xportr.label_verbose = "none",
xportr.length_verbose = "none",
xportr.type_verbose = "none",
)
# Will send Warning Message to Console
options(
xportr.format_verbose = "warn",
xportr.label_verbose = "warn",
xportr.length_verbose = "warn",
xportr.type_verbose = "warn",
)
```

## Going meta

Each of the core `{xportr}` functions requires several inputs: A valid dataframe, a metadata object and a domain name, along with optional messaging. For example, here is a simple call using all of the functions. As you can see, a lot of information is repeated in each call.
Expand Down
13 changes: 10 additions & 3 deletions vignettes/xportr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ DT::datatable(adsl, options = list(
autoWidth = FALSE, scrollX = TRUE, pageLength = 5,
lengthMenu = c(5, 10, 15, 20)
)) %>%
formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold", lineHeight = "70%")
formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold")
```

**NOTE:** The `ADSL` dataset can be created by using this command `admiral::use_ad_template("adsl")`.
Expand Down Expand Up @@ -128,11 +128,15 @@ DT::datatable(var_spec_view, options = list(
autoWidth = FALSE, scrollX = TRUE, pageLength = 5,
lengthMenu = c(5, 10, 15, 20)
)) %>%
formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold", lineHeight = "70%")
formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold")
```

# xportr_type()

**NOTE:** We make use of `str()` to expose the attributes (length, labels, formats, type)
of the datasets. We have suppressed these calls for the sake of brevity.


In order to be compliant with transport v5 specifications an `xpt` file can only have two data types: character and numeric/dbl. Currently the `ADSL` data set has chr, dbl, time, factor and date.

```{r, max_height = "200px", echo = FALSE}
Expand Down Expand Up @@ -188,7 +192,7 @@ DT::datatable(adsl_order, options = list(
autoWidth = FALSE, scrollX = TRUE, pageLength = 5,
lengthMenu = c(5, 10, 15, 20)
)) %>%
formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold", lineHeight = "70%")
formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold")
```

# xportr_format()
Expand Down Expand Up @@ -227,6 +231,9 @@ tribble(
)
```

**NOTE:** You can use `attr(data$variable, which = "format")` to inspect formats applied
to a dataframe. The above output has these individual calls bound together for easier viewing.

# xportr_label()

Please observe that our `ADSL` dataset is missing many variable labels. Sometimes these labels can be lost while using R's function. However, a CDISC compliant data set needs to have each variable with a label.
Expand Down

0 comments on commit ead17a8

Please sign in to comment.