小编mor*_*org的帖子

将绘图嵌入 PDF rmarkdown

我最初遇到了饼图中标签重叠的问题ggplot,因此建议我改用它plotly。这解决了我的标签重叠问题,但现在我需要找到一种方法将图形嵌入plotly到我的 PDF 文档中。

有了我的先验ggplot,我可以直接去'print(piechart, floating = FALSE)但它没有出现plotly。

---
title: "Untitled"
author: "Morg"
date: "August 20, 2019"
output: pdf_document
---

```{r setup, include=FALSE}
library(dplyr)
library(plotly)

#
rptyear <- 2018
colours <- c("A" = "royalblue3", "B" = "red", "C" = "gold", "D" = "green4")

# data
premiumtable <- data.frame(Var1 = rep(c("A","B","C","D"),11),
                           Var2 = c(rep(2009,4),rep(2010,4),rep(2011,4),rep(2012,4),rep(2013,4),rep(2014,4),rep(2015, 4),rep(2016,4), rep(2017,4),rep(2018,4),rep(2019,4)),
                           Freq = as.numeric(c(13223284, 3379574,721217, 2272843,14946074,4274769, 753797,2655032, 15997384, 4952687, 722556,3035566,16244348,5541543,887109,3299966,15841630,6303443,1101696,3751892,14993295, 6993626,1312650,4158196,13946038, 7081457,1317428,4711389, 12800640, 6923012, 1345159, …
Run Code Online (Sandbox Code Playgroud)

pdf r knitr r-markdown plotly

4
推荐指数
1
解决办法
3556
查看次数

通过VBA执行时R忽略R脚本

我正在尝试从excel VBA运行R脚本。该脚本仅查询数据,格式化和组织数据,然后将其导出为单独的XLS文件。但是,我无法运行R脚本。

本文的结束语:(尽管OG代码是我所了解的) 在没有RExcel的情况下从Excel VBA运行R 我由于下载的工作限制而无法访问RExcel。我已经找到我的R.exe文件路径,并且下面的宏可以运行:

 Dim rCommand As String
rCommand = "C:\Program Files\R\R-3.5.3\bin\R.exe --verbose U:\Reporting\Mix of Business Report\Morgan's Trials\Mix of Business Report v1.R"

'Timer Set to run full Model.R script
Application.Wait Now + TimeValue("00:01:05")

'Runs R Script and Arguments into process
shell rCommand, vbNormalFocus

'Timer Set to run full Model.R Script
Application.Wait Now + TimeValue("00:01:05")
Run Code Online (Sandbox Code Playgroud)

我希望宏在后台运行,但是R窗口(只要工作正常,就不要Rstudio了),它不能运行R脚本。

这是在“ Rterm”窗口中显示的内容:

CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows …
Run Code Online (Sandbox Code Playgroud)

excel vba r

3
推荐指数
1
解决办法
79
查看次数

标签 统计

r ×2

excel ×1

knitr ×1

pdf ×1

plotly ×1

r-markdown ×1

vba ×1