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

Create Tables with Variable Labels #74

Closed
hectormz opened this issue Mar 24, 2019 · 4 comments
Closed

Create Tables with Variable Labels #74

hectormz opened this issue Mar 24, 2019 · 4 comments

Comments

@hectormz
Copy link

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
Copy link
Owner

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
Copy link
Author

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 added a commit that referenced this issue Dec 2, 2019
Prior to this change only the variable name would be used to label the
row groups for `qsummary` and `summary_table`

This change looks to see if the attribute "label" has been set for a
variable in the data frame and uses that instead of the variable name.
If the attribute is NULL then the variable name will be used.  Examples
to follow.

re #74
dewittpe added a commit that referenced this issue Dec 2, 2019
@dewittpe
Copy link
Owner

dewittpe commented Dec 3, 2019

@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

@dewittpe dewittpe closed this as completed Dec 3, 2019
@hectormz
Copy link
Author

hectormz commented Dec 3, 2019

@dewittpe awesome! Thank you for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants