Skip to content

Commit

Permalink
docs: replace the docs where label is used
Browse files Browse the repository at this point in the history
  • Loading branch information
vedhav committed Nov 21, 2023
1 parent 399a4fd commit 1fa2b56
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion R/write.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
#' Param = c("param1", "param2", "param3")
#' )
#'
#' var_spec <- data.frame(dataset = "adsl", label = "Subject-Level Analysis Dataset")
#' xportr_write(adsl,
#' path = paste0(tempdir(), "/adsl.xpt"),
#' label = "Subject-Level Analysis",
#' metadata = var_spec,
#' strict_checks = FALSE
#' )
#'
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ adsl %>%
xportr_label(var_spec, "ADSL", verbose = "warn") %>%
xportr_order(var_spec, "ADSL", verbose = "warn") %>%
xportr_format(var_spec, "ADSL") %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```

The `xportr_metadata()` function can reduce duplication by setting the variable specification and domain explicitly at the top of a pipeline. If you would like to use the `verbose` argument, you will need to set in each function call.
Expand All @@ -146,7 +146,7 @@ adsl %>%
xportr_label() %>%
xportr_order() %>%
xportr_format() %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```

That's it! We now have a xpt file created in R with all appropriate types, lengths, labels, ordering and formats. Please check out the [Get Started](https://atorus-research.github.io/xportr/articles/xportr.html) for more information and detailed walk through of each `xportr_` function.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ adsl %>%
xportr_label(var_spec, "ADSL", verbose = "warn") %>%
xportr_order(var_spec, "ADSL", verbose = "warn") %>%
xportr_format(var_spec, "ADSL") %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```

The `xportr_metadata()` function can reduce duplication by setting the
Expand All @@ -156,7 +156,7 @@ adsl %>%
xportr_label() %>%
xportr_order() %>%
xportr_format() %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```

That’s it! We now have a xpt file created in R with all appropriate
Expand Down
3 changes: 2 additions & 1 deletion man/xportr_write.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 @@ -171,7 +171,7 @@ adsl %>%
xportr_label(var_spec, "ADSL", "message") %>%
xportr_order(var_spec, "ADSL", "message") %>%
xportr_format(var_spec, "ADSL") %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```

To help reduce these repetitive calls, we have created `xportr_metadata()`. A user can just **set** the _metadata object_ and the Domain name in the first call, and this will be passed on to the other functions. Much cleaner!
Expand All @@ -185,7 +185,7 @@ adsl %>%
xportr_label() %>%
xportr_order() %>%
xportr_format() %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```


Expand Down Expand Up @@ -410,7 +410,7 @@ adsl %>%
xportr_label() %>%
xportr_order() %>%
xportr_format() %>%
xportr_write(path = "adsl.xpt", label = "Subject-Level Analysis Dataset", strict_checks = FALSE)
xportr_write(path = "adsl.xpt", strict_checks = FALSE)
```

Success! We have applied types, lengths, labels, ordering and formats to our dataset. Note the messages written out to the console. Remember the `TRTDUR` and `DCREASCD` and how these are not present in the metadata, but in the dataset. This impacts the messaging for lengths and labels where `{xportr}` is printing out some feedback to us on the two issues. 5 types are coerced, as well as 36 variables re-ordered. Note that `strict_checks` was set to `FALSE`.
Expand All @@ -419,7 +419,7 @@ The next two examples showcase the `strict_checks = TRUE` option in `xportr_writ

```{r, echo = TRUE, error = TRUE}
adsl %>%
xportr_write(path = "adsl.xpt", label = "Subject-Level Analysis Dataset", strict_checks = TRUE)
xportr_write(path = "adsl.xpt", strict_checks = TRUE)
```


Expand All @@ -439,7 +439,7 @@ adsl %>%
xportr_label() %>%
xportr_type() %>%
xportr_format() %>%
xportr_write(path = "adsl.xpt", label = "Subject-Level Analysis Dataset", strict_checks = TRUE)
xportr_write(path = "adsl.xpt", strict_checks = TRUE)
```


Expand Down
2 changes: 1 addition & 1 deletion vignettes/xportr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ adsl %>%
xportr_label(var_spec, "ADSL", "message") %>%
xportr_order(var_spec, "ADSL", "message") %>%
xportr_format(var_spec, "ADSL") %>%
xportr_write("adsl.xpt", label = "Subject-Level Analysis Dataset")
xportr_write("adsl.xpt")
```

That's it! We now have a `xpt` file created in R with all appropriate types, lengths, labels, ordering and formats from our specification file. If you are interested in exploring more of the custom
Expand Down

0 comments on commit 1fa2b56

Please sign in to comment.