本文介绍了无法编译Rmarkdown文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很难让我的R markdown文档得到编译和执行.在分析中,我进行了单向,双向ANOVA和ANCOVA分析以及许多绘图.
I have a very difficult time to get my R markdown document compiled and execute. I have one-way, two-way ANOVA and ANCOVA analyses in the analysis along with many plots.
这是尚未成功执行的第一个R代码块.
Here is the first R code chunk yet to be successfully executed.
{r, echo=FALSE}
install.packages("rmarkdown")
library(rmarkdown)
install.packages("knitr")
library(knitr)
install.packages("ggplot2")
install.packages("car")
library(car)
install.packages("pastecs")
library(pastecs)
install.packages("compute.es")
library(compute.es)
install.packes("multcomp")
library(multcopm)
install.packes("WRS2")
library(WRS2)
install.packages("gmodels")
library(gmodels)
install.packes("MASS")
library(MASS)
执行停止
推荐答案
我通常会携带一些小功能
I usually carry small function
check_and_install <- function( packname ) { # given package name, check installation, install if not found
if ( packname %in% rownames(installed.packages()) == FALSE ) {
install.packages( packname )
}
}
所以在Rmd开始时我就做
so at the beginning of the Rmd i do
check_and_install("ggplot2")
library(ggplot2)
....
这篇关于无法编译Rmarkdown文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!