即使代码运行正常,也无法从R创建markdown文档

时间:2015-07-06 06:30:48

标签: r wordpress analytics r-markdown web-analytics

如果这听起来像是Rmarkdown中的一个非常基本的问题,我很抱歉。

我基本上是在尝试阅读一些文件(从网址下载我的wordpress帖子统计信息https://wordpress.com/stats/day/posts/myblog.wordpress.com?startDate=2015-01-01 etal

然后使用rbind

这是文件的基本数据结构。

                            V1   V2 year
1         Home page / Archives 1152 2011
2                  Hacker Poem  414 2011
3              Corporate Poems  294 2011
4                 For my child  232 2011
5           Poem on Steve Jobs  174 2011
6 I will never meet Steve Jobs  134 2011

我确实在导入中收到此警告消息,但它工作正常。

**> poem15=read.csv(a[7],header=F)
Warning message:
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  EOF within quoted string**


ls()
rm(list=ls())
gc()
getwd()
a=dir()
a[3:7]
a[3]
poem11=read.csv(a[3],header=F,sep=",")
poem11$year=2011
a[4]
poem12=read.csv(a[4],header=F,sep=",")
poem12$year=2012
a[5]
poem13=read.csv(a[5],header=F,sep=",")
poem13$year=2013
a[6]
poem14=read.csv(a[6],header=F,sep=",")
poem14$year=2014
a[7]
poem15=read.csv(a[7],header=F)
poem15$year=2015
poem15=na.omit(poem15)
poetry = rbind(poem11,poem12,poem13,poem14,poem15)
poetry=poetry[order(poetry$V2),]
boxplot(poetry$V2~poetry$year)

但是在尝试使用RStudio

进行编织时会出现此错误
Quitting from lines 3-28 (code_boiler.spin.Rmd) 
Error in rbind(deparse.level, ...) : 
  numbers of columns of arguments do not match
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> rbind -> rbind
Execution halted

1 个答案:

答案 0 :(得分:0)

如果编织HTML按钮不起作用,您可以尝试使用rmarkdown :: render()或knitr :: knit2html()。

```{r}
x <- data.frame(V1=c('Home page / Archives','Hacker Poem','Corporate Poems','For my child','Poem on Steve Jobs','I will never meet Steve Jobs'), V2=c(1152,414,294,232,174,134), year=2011)
rbind(x,x)
```