2017-08-31 84 views
0

早安 在R降价块,我试图用kable吐出一个表rmarkdown这里是我的伪数据:在继承(X,“列表)R降价错误找不到对象

whytheerror <- data.frame(name=c('school1','school2','school3','school4','school5','school6','school7','school8','school9','school10','school11'), count=c(13,25,36,44,58,63,76,85,93,78,101), percent=c(.7,.6,.2,.32,.41,.44,.97,.02,.31,.5,.11), other_count=c(15,111,33,74,19,5,3,111,1,37,501), other_percent=c(.4,.6,.3,.39,.45,.5,.02,.4,.06,.64,.11)) 

这里是我的代码:

```{r echo = FALSE, results = 'asis'} 
kable(whytheerror [1:12, ], caption = "Respondent Breakdown") 
``` 

和错误读取:

Error in inherits(x,"list"): object 'whytheerror ' not found calls: <Anonymous>...withCallingHandlers -> withVisible -> eval -> eval -> kable -> inherits 

我有困难figuri排除这个错误意味着更少修复它。有人可以协助任何一方或两方?

谢谢

+0

'name'有12个元素,其他有11.('school3'出现两次。) – Lyngbakr

+0

谢谢。为了这个问题,这是一个虚拟的数据集。尽管我已经编辑了代码。 – Walker

+0

我无法重现该错误,如下所示。你可以运行我的代码好吗? – Lyngbakr

回答

0

--- 
title: "Test" 
output: html_document 
--- 

```{r} 
whytheerror <- data.frame(name=c('school1','school2','school3','school4','school5','school6','school7','school8','school9','school10','school11'), count=c(13,25,36,44,58,63,76,85,93,78,101), percent=c(.7,.6,.2,.32,.41,.44,.97,.02,.31,.5,.11), other_count=c(15,111,33,74,19,5,3,111,1,37,501), other_percent=c(.4,.6,.3,.39,.45,.5,.02,.4,.06,.64,.11)) 
``` 

```{r echo = FALSE, results = 'asis'} 
library(knitr) 
kable(whytheerror[1:11, ], caption = "Respondent Breakdown") 
``` 

产生

enter image description here

没有错误。