From e188f502a5fbc836fe57394947ad347e64263deb Mon Sep 17 00:00:00 2001 From: bs832471 Date: Fri, 16 Jun 2023 15:50:35 +0000 Subject: [PATCH] #docs: example and ref blurb --- R/write.R | 11 +++++++++++ _pkgdown.yml | 8 +++++--- man/xportr_write.Rd | 11 +++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/R/write.R b/R/write.R index 371bc9b9..ff9db274 100644 --- a/R/write.R +++ b/R/write.R @@ -23,6 +23,17 @@ #' #' @return A data frame. `xportr_write()` returns the input data invisibly. #' @export +#' +#' @examples +#' adsl <- data.frame( +#' Subj = as.character(123, 456, 789), +#' Different = c("a", "b", "c"), +#' Val = c("1", "2", "3"), +#' Param = c("param1", "param2", "param3") +#' ) +#' +#' xportr_write(adsl, path = "adsl.xpt", label = "Subject-Level Analysis", strict_checks = FALSE) +#' xportr_write <- function(.df, path, label = NULL, strict_checks = FALSE) { path <- normalizePath(path, mustWork = FALSE) diff --git a/_pkgdown.yml b/_pkgdown.yml index 8e4bdb40..aa15825a 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -19,7 +19,7 @@ navbar: aria-label: slack reference: - - title: The six core xportr functions + - title: Core xportr functions - contents: - xportr_type - xportr_length @@ -27,8 +27,11 @@ reference: - xportr_write - xportr_format - xportr_order + - xportr_df_label + - xportr_metadata - title: xportr helper functions + desc: Utility functions called within core xportr functions - contents: - label_log - length_log @@ -36,8 +39,7 @@ reference: - var_names_log - var_ord_msg - xportr_logger - - xportr_df_label - - xportr_metadata + - title: xportr example datasets and specification files - contents: diff --git a/man/xportr_write.Rd b/man/xportr_write.Rd index 3399ab18..b68f9643 100644 --- a/man/xportr_write.Rd +++ b/man/xportr_write.Rd @@ -34,3 +34,14 @@ to the FDA. \item SAS type are stored in the "SAStype" attribute. } } +\examples{ +adsl <- data.frame( + Subj = as.character(123, 456, 789), + Different = c("a", "b", "c"), + Val = c("1", "2", "3"), + Param = c("param1", "param2", "param3") +) + +xportr_write(adsl, path = "adsl.xpt", label = "Subject-Level Analysis", strict_checks = FALSE) + +}