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

key_seq is not supported in spec_type_to_ds_vars() unless it is in an external sheet #11

Closed
kodesiba opened this issue Oct 12, 2021 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@kodesiba
Copy link

When using spec_type_to_ds_vars() with the key_seq variable in the main sheet it will not get passed through to create_table and will not get added on later. It looks as though only the cols argument is passed to create_table() therefore the key_seq variable will not get passed through and added on.

@kodesiba kodesiba added the bug Something isn't working label Oct 12, 2021
@kodesiba
Copy link
Author

core also looks to be getting lost in the mix as well

@kodesiba
Copy link
Author

library(tibble)
#> Warning: package 'tibble' was built under R version 4.0.5
library(metacore)

metadoc <- list("variables" = tribble(
   ~"dataset", ~"variable", ~"order", ~"keep", ~"key_seq", ~"core",
   "DM",       "STUDYID",   1,        "Yes",    1,         "Required",
   "DM",       "DOMAIN",    1,        "Yes",    NA,        "Required",
   "DM",       "USUBJID",   1,        "Yes",    2,         "Required",
))

metadoc$variables
#> # A tibble: 3 × 6
#>   dataset variable order keep  key_seq core    
#>   <chr>   <chr>    <dbl> <chr>   <dbl> <chr>   
#> 1 DM      STUDYID      1 Yes         1 Required
#> 2 DM      DOMAIN       1 Yes        NA Required
#> 3 DM      USUBJID      1 Yes         2 Required

ds_vars <- spec_type_to_ds_vars(metadoc,
                                key_seq_sep_sheet = FALSE,
                                sheet = "variables")

ds_vars
#> # A tibble: 3 × 6
#>   dataset variable order keep  key_seq core 
#>   <chr>   <chr>    <dbl> <lgl>   <int> <chr>
#> 1 DM      STUDYID      1 TRUE       NA <NA> 
#> 2 DM      DOMAIN       1 TRUE       NA <NA> 
#> 3 DM      USUBJID      1 TRUE       NA <NA>

@statasaurus
Copy link
Collaborator

All you need to do is move your key_seq in the cols argument

@mstackhouse mstackhouse added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants