From 0a0253eecdc4a8b4119f9966be9ae7be26aa5ada Mon Sep 17 00:00:00 2001 From: bs832471 Date: Thu, 15 Jun 2023 01:30:18 +0000 Subject: [PATCH] chore: #84 lint and style --- vignettes/deepdive.Rmd | 5 ++++- vignettes/xportr.Rmd | 34 +++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/vignettes/deepdive.Rmd b/vignettes/deepdive.Rmd index f521a5cf..a382be53 100644 --- a/vignettes/deepdive.Rmd +++ b/vignettes/deepdive.Rmd @@ -205,7 +205,10 @@ datatable( autoWidth = TRUE ) ) %>% - formatStyle(0, target = "row", color = "black", backgroundColor = "white", fontWeight = "bold", lineHeight = "70%", textAlign = "center") + formatStyle(0, + target = "row", color = "black", backgroundColor = "white", + fontWeight = "bold", lineHeight = "70%", textAlign = "center" + ) ``` ## `xportr_type()` diff --git a/vignettes/xportr.Rmd b/vignettes/xportr.Rmd index 1fab926b..5dd083ec 100644 --- a/vignettes/xportr.Rmd +++ b/vignettes/xportr.Rmd @@ -39,20 +39,18 @@ local({ ```{r, include=FALSE} - -knitr::knit_hooks$set(output = function(x, options){ - if(!is.null(options$max_height)){ - paste('
', 
-          x, "
", - sep = "") - } else{ +knitr::knit_hooks$set(output = function(x, options) { + if (!is.null(options$max_height)) { + paste('
',
+      x, "
", + sep = "" + ) + } else { x } - }) - ``` # Getting Started with xportr @@ -198,7 +196,7 @@ DT::datatable(adsl_order, options = list( Now we apply formats to the dataset. These will typically be `DATE9.`, `DATETIME20` or `TIME5`, but many others can be used. Notice that in the `ADSL` dataset there are 8 Date/Time variables and they are missing formats. Here we just take a peak at a few `TRT` variables, which have a `NULL` format. ```{r, max_height = "200px", echo = FALSE} -adsl_fmt_pre <- adsl %>% +adsl_fmt_pre <- adsl %>% select(TRTSDT, TRTEDT, TRTSDTM, TRTEDTM) tribble( @@ -206,9 +204,8 @@ tribble( "TRTSDT", attr(adsl_fmt_pre$TRTSDT, which = "format"), "TRTEDT", attr(adsl_fmt_pre$TRTEDT, which = "format"), "TRTSDTM", attr(adsl_fmt_pre$TRTSDTM, which = "format"), - "TRTEDTM", attr(adsl_fmt_pre$TRTEDTM, which = "format") - ) - + "TRTEDTM", attr(adsl_fmt_pre$TRTEDTM, which = "format") +) ``` Using our `xportr_format()` we can apply our formats to the dataset. @@ -218,7 +215,7 @@ adsl_fmt <- adsl %>% xportr_format(var_spec, domain = "ADSL", "message") ``` ```{r, max_height = "200px", echo = FALSE} -adsl_fmt_post <- adsl_fmt %>% +adsl_fmt_post <- adsl_fmt %>% select(TRTSDT, TRTEDT, TRTSDTM, TRTEDTM) tribble( @@ -226,9 +223,8 @@ tribble( "TRTSDT", attr(adsl_fmt_post$TRTSDT, which = "format"), "TRTEDT", attr(adsl_fmt_post$TRTEDT, which = "format"), "TRTSDTM", attr(adsl_fmt_post$TRTSDTM, which = "format"), - "TRTEDTM", attr(adsl_fmt_post$TRTEDTM, which = "format") - ) - + "TRTEDTM", attr(adsl_fmt_post$TRTEDTM, which = "format") +) ``` # xportr_label()