officedown | officer features into R markdown documents
kandi X-RAY | officedown Summary
kandi X-RAY | officedown Summary
{officedown} is bringing some officer features into R markdown documents.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of officedown
officedown Key Features
officedown Examples and Code Snippets
Community Discussions
Trending Discussions on officedown
QUESTION
ANSWER
Answered 2022-Apr-14 at 10:28You can define the margins you want to use (see ?rdocx_document
argument page_margins
):
QUESTION
How can I insert two images side by side into a word document (.docx) with captions?
I found several solutions for HTML and pdf documents. However, for word documents, this doesn't seem to be the case.
This is my YAML:
...ANSWER
Answered 2022-Mar-09 at 11:56Since no one commented yet, I am just pointing out that you could, as a workaround, use a two column layout (you have to load the officer
package as well for the alignment). Either put the graphs with caption in separate columns (if they have the same height this works well), or just add the captions below the side-by-side graph, e.g. like this in the first scenario:
QUESTION
I want to add a colored dot in a new column based on the value of another column.
I have:
...ANSWER
Answered 2022-Feb-10 at 17:21You can achieve this by vectorizing your colour_choice
function:
QUESTION
Using code below, I'm able to generate a ppt report for subset of mtcars
dataset:
ANSWER
Answered 2022-Jan-11 at 16:46You could put your plotting code in a function which e.g. takes two arguments, a dataframe (x) and a title.
Similarly put the code to prepare the pptx inside a function, which e.g. takes two arguments, a dataframe (x) and a title or filename or ...
In my code below I have put your three datasets in a list and then make use of purrr::iwalk
to loop over this list to make a pptx report for each dataset. Using purrr::iwalk
the name of the dataset is passed as the second argument to the reporting function.
QUESTION
My prior understanding was that the ability to utilize Microsoft Word Table styles is only available in the officedown
package, but syntax like
ANSWER
Answered 2022-Jan-04 at 17:44You can use body_add_table()
:
QUESTION
I feel like I am missing something easy. Fingers crossed thats it.
Im trying to produce tables using gtsummary and flextable in officedown. I'm using the yaml options from the "Advanced word document" template in officedown.
Below is my code. The first 2 tables have the captions underneath and the third is on top, as it should be!
...ANSWER
Answered 2021-Dec-15 at 08:35Not an expert in flextable
and officedown
. But one option which worked for me was to set the position of the table captions for the R Markdown document via
knitr::opts_chunk$set(tab.topcaption = TRUE)
.
Full reproducible code:
QUESTION
I'm using the officedown
package to generate a Word document. May I ask, if I want to import a well-designed figure from the disk, how to control officedown
not to change the height/width ratio of the figure?
For example, my original figure looks like this:
However, in the Word document generated by officedown
, it looks like this:
May I ask, how to avoid the distortion in officedown
? And how to make the width of the figure take the whole line?
My question can be reproduced by the following code:
...ANSWER
Answered 2021-Dec-14 at 13:39I have a little experimented.
For the output:
QUESTION
Running R4.1.2 and Windows 10:
I'm trying to knit a document that has a flextable with a ggplot image that was created via ggsave. When I run the code chunk in RMarkdown, it works fine, but when I attempt to knit a word document, I get the following error. If I don't include the image, knitr works fine.
...ANSWER
Answered 2021-Nov-21 at 10:28I could not reproduce your error. Below the code to produce your table. There are two solutions, my recommended solution (documented here: https://ardata-fr.github.io/flextable-book/cell-content-1.html#base-plots-and-ggplot-objects) and something closer to what you wrote.
QUESTION
I want to create a .docx
report with {officedown}, but instead of using "bookmark" reference types for cross-referencing my tables and figures as suggested in ch.4.6 and ch.4.7 of the User Documentation, I would like my references to be actual "Figure" and "Table" reference types in the resulting .docx
. As discussed in this stackoverflow post, this would require {SEQ Figure \\* arabic}
and {SEQ Table \\* arabic}
word fields and the answers show how to implement this via officer::slip_in_seqfield()
or crosstable::body_add_table_legend()
.
However, I think, these approaches to obtain actual "Figure" and "Table" reference types only work for the {officer} syntax and not the {officedown} syntax. To be clear, so far I understood
- {officer} syntax as an R-script that makes use of a
dplyr
chain that starts withread_docx() %>%
[example] - {officedown} syntax as an Rmd-script that makes use of
block_caption()
andrun_autonum()
within a chunk [example]
(please correct me if I am wrong)
Therefore, I would like to know whether there is a way to modify the suggested approach in {officedown} in order to obtain actual "Figure" and "Table" reference types that I can also cross-reference in the text. Below is an example using the standard suggested approach:
...ANSWER
Answered 2021-Jul-29 at 11:30As you can read in crosstable's vignette (https://danchaltiel.github.io/crosstable/articles/crosstable-report.html), you can use this syntax:
QUESTION
I'm using officedown with Rmarkdown to knit word docs and currently it's not reading level 4 and 5 headers in the Table of Contents (though it's correctly adding headers levels 1-3). My YAML is:
...ANSWER
Answered 2021-May-11 at 16:10Changing the table of contents block from
to
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install officedown
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page