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

The output of the knitr option "word_document" shows the name of the variable and not its assigned labels #324

Open
cjaa-old opened this issue Apr 16, 2021 · 2 comments

Comments

@cjaa-old
Copy link

cjaa-old commented Apr 16, 2021

When I run the chunk of code individually from Rmarkdown the output is a "knit_asis" type table that perfectly displays the table (including the labels for each variable). However, when I generate a word document using "knitr" the names shown in the table are those of the original variables (e.g. "age") and not the labels assigned to them (e.g. "Age in Years"). It seems that the problem is at the moment of generating the word document. I don't know if there is an option to show the labels and not the original variable name. Thank you.

Output in Rmarkdown
image

Output in Word
image

@cjaa-old
Copy link
Author

cjaa-old commented Apr 16, 2021

I just realized that I would have to specify in the function "summary", argument "labbelTranslations", the name of the labels of each variable for it to appear in the word, even though by default each variable has a label assigned to it. That is to say, if I do not specify the value of the argument "labbelTranslations" in the output of the chunk of code, I still get the labels and not the original name of the variable. Is there any way to show the labels already assigned automatically?

Output in Rmarkdown

image

Output in Word document

image

@eheinzen
Copy link
Collaborator

Without seeing your session, it's hard for me to tell what's going on. I'm wondering if your interactive objects aren't matching what gets produced by Rmarkdown when you knit in a new session. If that's the case, try restarting your R session, running every code chunk above this one, and then seeing what the output is in the knit_asis environment.

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

No branches or pull requests

2 participants