We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
As a user, I want yspec to generate a string with column definitions which I can include in a table footnote.
The text was updated successfully, but these errors were encountered:
ys_abb_note <- function(spec, short_max = Inf, title_case = TRUE, width = NULL, abb_unit = FALSE) { ans <- ys_abb_note_df(spec, short_max, title_case, abb_unit = abb_unit) if(short_max < Inf) { keep <- ans$long ans <- ans[keep,] } ans <- paste0(ans$col, ": ", ans$short2, collapse = '; ') ans <- toString(ans) if(is.numeric(width)) { ans <- strwrap(ans, width = width) } ans } ys_abb_note_df <- function(spec, short_max = Inf, title_case = TRUE, abb_unit = FALSE) { short <- ys_get_short(spec, short_max = short_max) short <- unlist(short, use.names=FALSE) short2 <- ys_get_short(spec) short2 <- unlist(short2, use.names=FALSE) long <- short == names(spec) & short2 != names(spec) if(title_case) { short <- tools::toTitleCase(short) short2 <- tools::toTitleCase(short2) } unit <- ys_get_unit(spec, parens = TRUE) short1 <- paste0(short, " ", unit) if(isTRUE(abb_unit)) { short2 <- paste0(short2, " ", unit) } else { short2 <- short2 } data.frame( col = names(spec), short1 = short1, short2 = short2, unit = unlist(unit, use.names = FALSE), long = long ) } ys_abb_note_df(spec, short_max = 20) ys_abb_note(spec, short_max = 20)
Sorry, something went wrong.
kylebaron
Successfully merging a pull request may close this issue.
Summary
As a user, I want yspec to generate a string with column definitions which I can include in a table footnote.
Tests
The text was updated successfully, but these errors were encountered: