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

ys_col_note #120

Merged
merged 5 commits into from
Mar 19, 2022
Merged

ys_col_note #120

merged 5 commits into from
Mar 19, 2022

Conversation

kylebaron
Copy link
Contributor

@kylebaron kylebaron commented Mar 18, 2022

Summary

  • Select some columns from a yspec object and create a column definition string
  • Optionally append the unit; QUESTION - should this default to TRUE?
  • Optionally convert to title case; QUESTION - should this default to TRUE?
  • Optionally convert to a single string; this currently defaults to TRUE

@KatherineKayMRG I simplified this quite a bit based on initial prototyping. I felt like it wasn't that obvious what columns were going to come back in the note and that it was reasonable to just ask to name the columns to appear. This would (I think) also allow user to enforce an order which might be nice.

Example

library(yspec)
spec <- ys_help$spec()

ys_col_note(spec, ALT, AST, SCR, AMT, AAG, BLQ,  .to_string = TRUE)
#> [1] "ALT: alanine aminotransferase; AST: aspartate aminotransferase; SCR: serum creatinine; AMT: dose amount; AAG: alpha-1-acid glycoprotein; BLQ: below limit of quantification"

Created on 2022-03-17 by the reprex package (v2.0.1)

@kylebaron kylebaron linked an issue Mar 18, 2022 that may be closed by this pull request
Copy link
Contributor

@KatherineKayMRG KatherineKayMRG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I had one suggestion to for the code.

To answer you questions above:

  • I would default to no units. No huge preference but my thinking was if I use this selectively for a subset of longer column definitions then I would already have chosen to either add the units to the table directly (in which case, no need to duplicate them) or I would have chosen not to add them (in which case it would be odd to only add it to a few in the footer). Having said that, if someone is using this to explain all abbreviations, I would hate them to forget the units... maybe that would be a better argument to keep them?
  • I would suggest we don't default to title case - you don't use it when explaining abbreviations used in the canned pmtables functions and I could see this being used frequently with those tables. It would look more odd to see a mix of cases used
  • Happy to go with the convenience of a single string but I like that you added the flexibility in there. I can see someone wanting a series of abbreviations from the spec and plus one/two additional ones they want to squeeze in somewhere.

R/col-note.R Outdated Show resolved Hide resolved
R/col-note.R Outdated Show resolved Hide resolved
kylebaron and others added 2 commits March 18, 2022 15:51
Co-authored-by: KatherineKayMRG <42553148+KatherineKayMRG@users.noreply.github.com>
@kylebaron
Copy link
Contributor Author

@KatherineKayMRG Thanks for reviewing; I believe everything is up to date based on your review.

@kylebaron kylebaron changed the title initial commit for col note ys_col_note Mar 18, 2022
Copy link
Contributor

@KatherineKayMRG KatherineKayMRG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kylebaron - Looks great!

@kylebaron
Copy link
Contributor Author

Awesome!

@kylebaron kylebaron merged commit b2aae5e into develop Mar 19, 2022
@kylebaron kylebaron deleted the feature/col-note branch March 19, 2022 04:27
@kylebaron kylebaron mentioned this pull request May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate string with column defs for inclusion in table footnote
2 participants