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

@hectormz hectormz commented Mar 24, 2019

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

@dewittpe dewittpe commented Mar 25, 2019

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

@hectormz hectormz commented Oct 31, 2019

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
re #74
@dewittpe
Copy link
Owner

@dewittpe 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 Dec 3, 2019
@hectormz
Copy link
Author

@hectormz 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.