Error knittting Error in : cannot coerce class 'c("gg", "ggplot")' to a data.frame

When I knit my .Rmd file, the following problem arises:

Quitting from lines 129-134 (stat_inf_project.Rmd) 
Error in : cannot coerce class 'c("gg", "ggplot")' to a data.frame
Calls: <Anonymous> ... eval -> View -> ->
Ejecución interrumpida Please ask your questions about R Markdown here.

The lines 129-134 are:

gr_income_W_time<-ggplot(Income_W_time_resume,aes(x=income06,y=Total))+geom_col()+theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 0.5))+ggtitle("Distribución de ingresos anuales - raza blanca")+xlab("Rango ingresos")+ylab("Total encuestados")
gr_income_W_time+facet_grid(year ~ .)

I don't know what's wrong. I can run the chunk without problems

View is a function to show the data interactively in a GUI, R one or RStudio Table View.

You can't really use it in non-interactive way, like when compiling a Rmd document.

You should comment this out, and it should work I guess.

Thank you, very much!!

It worked perfectly.


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.