tangerine7199
tangerine7199

Reputation: 489

R Markdown Error in inherits(x, "list) object not found

Good Morning! In an R Markdown chunk, I am trying to use kable to spit out a table in rmarkdown. Here's my dummy data:

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))

Here's my code:

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

and the error reads:

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

I'm having difficulty figuring out what this error means much less fixing it. can someone assist with either or both?

thank you

Upvotes: 1

Views: 1180

Answers (1)

Dan
Dan

Reputation: 12074

This

---
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")
```

produces

enter image description here

No error.

Upvotes: 0

Related Questions