Closed ynsec37 closed 6 months ago
@ynsec37 this is fixed now in #256. If you are able to test it out, I'd love to hear if it's working for you!
@ynsec37 this is fixed now in #256. If you are able to test it out, I'd love to hear if it's working for you!
@EeethB Thank you very much. I had tested it and fixed the above case.
What happened?
When using the
xportr
to write the full sdtm(parent sdtm and supplemental in one dataset), it may be not a submission dataset but very usefull. I hope it can provide more flexibility, although thexportr
is designed to created CDISC compliant submission datasets.In this case I need create a variable that contains both parent variables and supplemental variables, use another variable to distinguish them.
dataset
(getOption("xportr.domain_name")
) for filteringdomain
for distinguishing.After checking the final output, the supplemental variables are ignored, e.g. missing label.
This is due to the filtering code
metadata <- metadata %>% filter(!!sym(domain_name)==domain)
will turn tometadata <- metadata %>% filter(dataset == domain)
, then it will filter the recordsdataset == domain
notdataset == "AE"
For now, I just delete the
domain
when writing xpt. The more robust way is to explicitly use the.data
and.env
to avoid it like belowmetadata <- metadata %>% filter(.data[[domain_name]]==.env$domain)
Session Information
R version 4.2.3 (2023-03-15 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale: [1] LC_COLLATE=Chinese (Simplified)_China.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8 LC_MONETARY=Chinese (Simplified)_China.utf8 [4] LC_NUMERIC=C LC_TIME=Chinese (Simplified)_China.utf8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] dplyr_1.1.2 xportr_0.3.0 devtools_2.4.5 usethis_2.2.2
loaded via a namespace (and not attached): [1] Rcpp_1.0.11 lubridate_1.9.2 prettyunits_1.1.1 ps_1.7.5 digest_0.6.33 utf8_1.2.3 mime_0.12
[8] slam_0.1-50 R6_2.5.1 reprex_2.0.2 evaluate_0.21 pillar_1.9.0 rlang_1.1.1 rstudioapi_0.15.0 [15] miniUI_0.1.1.1 callr_3.7.3 urlchecker_1.0.1 R.utils_2.12.2 R.oo_1.25.0 rmarkdown_2.23 styler_1.10.1
[22] readr_2.1.4 stringr_1.5.0 htmlwidgets_1.6.2 shiny_1.7.4.1 xfun_0.39 compiler_4.2.3 httpuv_1.6.11
[29] janitor_2.2.0 pkgconfig_2.0.3 pkgbuild_1.4.2 dso.sdtm_0.1.0 clipr_0.8.0 htmltools_0.5.5 tidyselect_1.2.0 [36] tibble_3.2.1 fansi_1.0.4 crayon_1.5.2 tzdb_0.4.0 withr_2.5.0 later_1.3.1 R.methodsS3_1.8.2 [43] brio_1.1.3 xtable_1.8-4 lifecycle_1.0.3 magrittr_2.0.3 cli_3.6.1 stringi_1.7.12 cachem_1.0.8
[50] fs_1.6.2 promises_1.2.0.1 remotes_2.4.2 testthat_3.1.10 NLP_0.2-1 snakecase_0.11.0 xml2_1.3.5
[57] ellipsis_0.3.2 generics_0.1.3 vctrs_0.6.3 tools_4.2.3 forcats_1.0.0 R.cache_0.16.0 glue_1.6.2
[64] purrr_1.0.1 hms_1.1.3 yaml_2.3.7 processx_3.8.2 pkgload_1.3.2.1 parallel_4.2.3 fastmap_1.1.1
[71] timechange_0.2.0 datapasta_3.1.0 tm_0.7-11 sessioninfo_1.2.2 memoise_2.0.1 knitr_1.43 haven_2.5.3
[78] profvis_0.3.8
Reproducible Example
Created on 2023-07-27 with reprex v2.0.2