metrumresearchgroup / yspec

Data Specification for Pharmacometrics
https://metrumresearchgroup.github.io/yspec
5 stars 2 forks source link

Return length-zero yspec if nothing selected #100

Closed kylebaron closed 2 years ago

kylebaron commented 2 years ago

Summary

Reviewers: please think though if this should be the new behavior (I believe it is but want to critically think it through). Thanks!

New Behavior

library(yspec)

spec <- ys_select(ys_help$spec())
length(spec)
#> [1] 0
spec
#> [1] name   c      d      unit   short  source
#> <0 rows> (or 0-length row.names)
names(get_meta(spec))
#>  [1] "description"     "sponsor"         "projectnumber"   "use_internal_db"
#>  [5] "glue"            "flags"           "lookup_file"     "spec_file"      
#>  [9] "spec_path"       "name"            "data_stem"       "data_path"      
#> [13] "primary_key"     "control"         "namespace"

Created on 2022-01-06 by the reprex package (v2.0.1)

KatherineKayMRG commented 2 years ago

I hadn't thought about it much before but it makes sense that it returns nothing if the flag doesn't exist. Seems like it would help avoid situations like Sam's and I can't think of any scenarios we'd prefer the current return everything approach.