从R脚本

时间:2016-05-11 22:38:51

标签: html r knitr

从R脚本(在Rstudio中完成)编译HTML笔记本后,我得到一个HTML笔记本,但没有图像或图形出现,除了出现在HTML文档最后一个基于最后一个代码的图形。如何在不更新R版本和Rstudio版本的情况下解决这个问题(我有工作限制)?

R版本= 3.0.0; Rstudio版本= 0.97.551

当我在Rstudio中运行代码时,生成图表没有问题。但是当我编译时,没有图表。

HTML笔记本中出现的一些警告消息如下: ""警告在par(" page"):" page"不是图形参数"" [其次是] "" plot_snapshot中的警告(incomplete_plots):请至少升级R. 版本3.0.2""

我的脚本中使用了以下库(从HTML笔记本中复制):

#Setup libraries first

library("openair")

#Warning: package 'openair' was built under R version 3.0.3
library("lattice")
Warning: package 'lattice' was built under R version 3.0.3
library("ggplot2")
Warning: package 'ggplot2' was built under R version 3.0.3

以下是我的一些脚本示例(它不会发生太大变化):

#Displays graphs for each day of the week. Best way to represent hourly data.

timeVariation (data, pollutant= "temp", xlab=c("Hour", "Hour", "Month", "Weekday"),
               ylab = expression("Temperature ("^o*"C)"), 
               main="Distribution of Hourly Temperature for 2012 to 2015", 
               name.pol="Temperature")
Warning in par("page"): "page" is not a graphical parameter
Warning in plot_snapshot(incomplete_plots): Please upgrade R to at least
version 3.0.2
### (B) ### Box Plot by Month and by Year based on Hourly Temperature Data from years 2012-2015 #######
data <- cutData(data,type= "month")
data <- cutData(data,type= "year")

ggplot(data=data, aes(x=month,y=temp)) + geom_boxplot(fill="grey") + 
  stat_boxplot(geom="errorbar", width=0.5)+
  ggtitle("Distribution of Hourly Temperature by Month (2012-2015)") + 
  xlab("") +
  ylab(expression("Temperature ( "^o*"C)")) + theme_bw()
Warning in par("page"): "page" is not a graphical parameter
Warning in plot_snapshot(incomplete_plots): Please upgrade R to at least
version 3.0.2
Warning in loop_apply(n, do.ply): Removed 291 rows containing non-finite
values (stat_boxplot).
Warning in loop_apply(n, do.ply): Removed 291 rows containing non-finite
values (stat_boxplot).

我尝试使用在线资源解决此问题,但没有成功。有关如何解决我的问题的任何想法?如果您需要更多信息,请与我们联系。

0 个答案:

没有答案