dewittpe / qwraps2

An updated version of qwraps with a focus on flexibility and general purpose. These functions are helpful for extracting and formatting results from R into .Rnw or .Rmd files. Additional functions for routine work such as extracting results from regression models or finding sensitivity and specificity.
http://www.peteredewitt.com/qwraps2/
GNU General Public License v3.0
37 stars 7 forks source link

Create Tables with Variable Labels #74

Closed hectormz closed 4 years ago

hectormz commented 5 years ago

Is it possible to create tables using the dataframe's variable labels instead of the variable names? This would be useful when using qsummary() to generate automatic/default tables without manually setting variable display names.

dewittpe commented 5 years ago

I would expect the answer is yes. However, before I can give a definitive answer I would like to see a reproducible example of what you are looking for. My only experience with using variable labels in a data.frame relies on either the Hmisc or setting a attribute "label" for each element of the data frame explicitly. If you are using some other set up for variable labels I would like to know.

hectormz commented 5 years ago

Hi I believe my inspiration for this enhancement came from this usage explained for sjPlot: https://dmyee.files.wordpress.com/2016/03/table_workshop.pdf image image

dewittpe commented 4 years ago

@hectormz : I have added to the qsummary call to use the label attribute, if it exists, on the data frame for building summary tables. An example as been added to the vignette as well. The update has been pushed to CRAN for qwraps2 version 0.4.2.

https://cran.r-project.org/web/packages/qwraps2/vignettes/summary-statistics.html#using-variable-labels

hectormz commented 4 years ago

@dewittpe awesome! Thank you for the update!