metrumresearchgroup / pmtables

TeX tables for pharmacometrics.
https://metrumresearchgroup.github.io/pmt-book
11 stars 1 forks source link

pt_data_inventory to update colname/footer when I use BLQ #254

Closed KatherineKayMRG closed 2 years ago

KatherineKayMRG commented 2 years ago

Summary

As a user, I want pt_data_inventory to change my colname/footer description for BLQ if I use bq_col = "BLQ"

Tests

kylebaron commented 2 years ago

How about this?

library(pmtables)

bq_col <- "BQL"
pt_data_inventory_notes(bq_col)
#> [1] "SUBJ: subjects"                      
#> [2] "BQL: below quantitation limit"       
#> [3] "MISS: missing observations (not BQL)"
#> [4] "OBS: observations"
bq_col <- "BLQ"
pt_data_inventory_notes(bq_col)
#> [1] "SUBJ: subjects"                      
#> [2] "BLQ: below limit of quantitation"    
#> [3] "MISS: missing observations (not BQL)"
#> [4] "OBS: observations"

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

kylebaron commented 2 years ago

Hang on; need to fix MISS then.

kylebaron commented 2 years ago
library(pmtables)

bq_col <- "BQL"
pt_data_inventory_notes(bq_col)
#> [1] "SUBJ: subjects"                   "BQL: below quantitation limit"   
#> [3] "MISS: missing observations (BQL)" "OBS: observations"
bq_col <- "BLQ"
pt_data_inventory_notes(bq_col)
#> [1] "SUBJ: subjects"                   "BLQ: below limit of quantitation"
#> [3] "MISS: missing observations (BLQ)" "OBS: observations"

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

kylebaron commented 2 years ago

And then handling if we just don't want BLQ

library(pmtables)

bq_col <- "BQL"
pt_data_inventory_notes(bq_col)
#> [1] "SUBJ: subjects"                   "BQL: below quantitation limit"   
#> [3] "MISS: missing observations (BQL)" "OBS: observations"
bq_col <- "BLQ"
pt_data_inventory_notes(bq_col)
#> [1] "SUBJ: subjects"                   "BLQ: below limit of quantitation"
#> [3] "MISS: missing observations (BLQ)" "OBS: observations"
pt_data_inventory_notes(bq_col, drop_bql = TRUE)
#> [1] "SUBJ: subjects"             "MISS: missing observations"
#> [3] "OBS: observations"

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

KatherineKayMRG commented 2 years ago

That looks good - does BLQ appear in the column headings too for bq_col <- "BLQ"

KatherineKayMRG commented 2 years ago

Also, did we ever come to a decision regarding "quantitation" vs "quantification"?

kylebaron commented 2 years ago

We can change that too; will check on columns and make sure it's right.

kylebaron commented 2 years ago

Closer ...

Screen Shot 2022-01-13 at 5 46 54 PM Screen Shot 2022-01-13 at 5 46 47 PM Screen Shot 2022-01-13 at 5 46 44 PM
KatherineKayMRG commented 2 years ago

That looks good to me :)

kylebaron commented 2 years ago

Cool; I'll get this cleaned up and documented etc. Thanks for the report. Also ... can you move the text starting with For example out of the main post and into a comment? I'd like to keep this issue open and that can't be there in the validation docs.

KatherineKayMRG commented 2 years ago

Thanks for getting to this so quickly!

kylebaron commented 2 years ago

I don't want to have to use gsub in this example

pkSum %>%
  pt_data_inventory(by = c("Race" = "RACEA_f"), 
                    panel = "DVID_f",
                    stacked = T,
                    bq_col = "BLQ") %>% 
  as_stable(output_file = "pk-data-sum.tex") %>% 
  gsub("BQL", "BLQ", .) %>%  
  gsub("below quantitation limit", "below limit of quantitation", .)
KatherineKayMRG commented 2 years ago

Sorry, I just realised what you meant but now it won't let me change my original comment

KatherineKayMRG commented 2 years ago

oh nm, looks like you managed it