Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: xportr_type() doesn't respect the xportr.variable_name and xportr.type_name options #275

Closed
mstackhouse opened this issue Oct 18, 2024 · 0 comments · Fixed by #276
Closed
Labels
bug Something isn't working programming

Comments

@mstackhouse
Copy link
Contributor

mstackhouse commented Oct 18, 2024

What happened?

The xportr.variable_name and xportr.type_name don't work as overrides within xportr_type() when the options are set to different variable names than the assumed defaults.

Note that the options are pulled here

But here the variable names aren't reassigned when selected from the metadata.

Session Information

R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8    
 [5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8    LC_PAPER=C.UTF-8       LC_NAME=C             
 [9] LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] xportr_0.4.1          stringr_1.5.1         lubridate_1.9.3       dplyr_1.1.4          
[5] admiral_1.1.1         pharmaversesdtm_1.0.0 datasetjson_0.2.0    

loaded via a namespace (and not attached):
 [1] utf8_1.2.4         generics_0.1.3     tidyr_1.3.1        renv_1.0.11       
 [5] stringi_1.8.4      jsonvalidate_1.3.2 hms_1.1.3          digest_0.6.37     
 [9] magrittr_2.0.3     evaluate_1.0.1     timechange_0.3.0   fastmap_1.2.0     
[13] cellranger_1.1.0   jsonlite_1.8.9     processx_3.8.4     writexl_1.5.1     
[17] backports_1.5.0    ps_1.8.0           admiraldev_1.1.0   purrr_1.0.2       
[21] fansi_1.0.6        cli_3.6.3          rlang_1.1.4        crayon_1.5.3      
[25] reprex_2.1.1       withr_3.0.1        yaml_2.3.10        tools_4.4.1       
[29] tzdb_0.4.0         checkmate_2.3.2    forcats_1.0.0      vctrs_0.6.5       
[33] R6_2.5.1           lifecycle_1.0.4    fs_1.6.4           pkgconfig_2.0.3   
[37] callr_3.7.6        pillar_1.9.0       glue_1.8.0         haven_2.5.4       
[41] xfun_0.48          tibble_3.2.1       tidyselect_1.2.1   rstudioapi_0.17.0 
[45] knitr_1.48         htmltools_0.5.8.1  rmarkdown_2.28     readr_2.1.5       
[49] compiler_4.4.1     readxl_1.4.3      

Reproducible Example

library(xportr)
library(magrittr)
data("adsl_xportr", "var_spec", "dataset_spec", package = "xportr")

xportr_options(
  xportr.variable_name = "Variable",
  xportr.type_name = "Data Type"
)

adsl_xportr %>% 
  xportr_type(var_spec, "ADSL", "message")
#> ℹ There are multiple specs for the same variable name. Check the metadata and variable name option `getOption('xportr.variable_name')`
#> Error in `left_join()`:
#> ! Join columns in `y` must be present in the data.
#> ✖ Problem with `variable`.

Created on 2024-10-18 with reprex v2.1.1

@mstackhouse mstackhouse added bug Something isn't working programming labels Oct 18, 2024
@mstackhouse mstackhouse mentioned this issue Oct 18, 2024
15 tasks
@elimillera elimillera linked a pull request Nov 26, 2024 that will close this issue
15 tasks
elimillera added a commit that referenced this issue Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working programming
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant