我正在使用officer
R中的程序包将地块转移到演示文稿中。
可以使用ph_with_gg()
函数来传输ggplot,但是传递普通R图的功能是什么?我在软件包中找不到任何此类功能。
这些是我所引用的一些资源:
您的帮助将不胜感激!
问候
使用officer
R中的包时,使用PowerPoint时,您可以使用该功能添加文本ph_with_text
.但是,目前尚不清楚如何添加多个文本项目符号或如何设置缩进级别.我想实现以下结构:
我尝试过两种方法都会产生非常错误的结果.我尝试了我的文本并添加\n
并\n\t
创建换行符和标签(就像我将如何在PowerPoint中创建结构一样).
doc = read_pptx()
doc = add_slide(layout = "Title and Content", master = "Office Theme")
doc = ph_with_text(doc,type = "body",
str = "Question 1\n\tAnswer 1\n\tAnswer 2\nQuestion 2\n\tAnswer 1\n\tAnswer 2",
index = 1)
Run Code Online (Sandbox Code Playgroud)
这会产生子弹,但不会产生深度.在每个答案之前,每个项目符号后面都有一个空白选项卡.此外,这些不是新的项目符号,如果我手动编辑文件并按下一个项目符号上的选项卡,之后的每个点也会移动.显然,没有实现正确的结构.
我也试过ph_with_text
反复打电话.
doc = add_slide(layout = "Title and Content", master = "Office Theme")
doc = ph_with_text(doc,type = "body", str = "Question 1", index = 1)
doc = ph_with_text(doc,type = "body", str …
Run Code Online (Sandbox Code Playgroud) 我想将图表导出到PPT,并使用官方包来实现相同的目标.但是,图表的默认分辨率很低,我想改变它.我目前正在使用以下电话
ph_with_gg(p1,type = "chart",res = 1200)
Run Code Online (Sandbox Code Playgroud)
其中p1是ggplot对象.运行此时,我收到以下错误:
Error in png(filename = file, width = width, height = height, units =
"in", :
formal argument "res" matched by multiple actual arguments
Run Code Online (Sandbox Code Playgroud)
非常感谢周围的帮助
我正在尝试使用官员更改段落的字体大小,但我无法做到。谁能告诉我我做错了什么?
library(officer)
text_style <- fp_text(font.size = 12)
my_doc <- read_docx()
body_add_par(my_doc,"This is a test", style = text_style)
print(my_doc, target = "dummy.docx")
Run Code Online (Sandbox Code Playgroud) ---
title: "Untitled"
author: "April 2018"
date: "4/9/2019"
output: powerpoint_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Slide with Plot
```{r pressure, fig.width=30, fig.asp=0.618, out.width="200%"}
plot(pressure)
```
Run Code Online (Sandbox Code Playgroud)
我正在阅读R Studio在R Markdown中创建PowerPoint演示文稿的指南。我希望能够自定义幻灯片,使其包括以下两点:
经过一些互联网搜索后,我无法确定如何正确执行此操作。也许你知道。这就是我要的东西(下图)。调整输出宽度似乎并没有太大帮助。
使用官员创建的 Powerpoint 中的标题字体没有变化。
我尝试将 fp_text 添加到 ph_with 中,虽然它不运行任何内容,但它从中生成任何内容。
library(officer)
library(magrittr)
title.font <- fp_text(font.size = 28)
example_pp <- read_pptx() %>%
# LMS slide ----
add_slide(layout = "Title and Content", master = "Office Theme") %>%
ph_with(paste("Title font test"),
location = ph_location_type(type = "title"),
fp_text(font.size = 28))
Run Code Online (Sandbox Code Playgroud) 我已经使用官员包创建了 powerpoint 文件,我还想将它们保存为 R 中的 pdf(不想手动打开每个文件并将其另存为 pdf)。这可能吗?