# chunk ran only once knitr/lyx then error

I am having trouble when I run the following code in lyx, using a script written in R:

clean_cache(clean = TRUE)

<<echo=TRUE,results='asis'>>=

library(knitr)
library(RMySQL)
library(xtable)

#open mysql database

uno<-dbGetQuery(con, "SELECT nhijl FROM resumen where leche;")

#create table
tabla_uno<-data.frame(Total_hijas=round((c(min(uno$nhijl),quantile(uno$nhijl,probs=(0.25)),quantile(uno$nhijl,probs=0.5),mean(uno$nhijl),quantile(uno$nhijl,probs=0.75), max(uno$nhijl)))))

rownames(tabla_uno)<-(c("Mínimo","1er. cuartil", "Mediana", "Media", "3er. cuartil", "Máximo"))
print(xtable(tabla_uno))
@


It seems strange because the first time I ran de code, I had as a result the table I expected, however when I tried a second time, the chunk could not be processed to pdf format.

2 major errors were displayed:

1)

! Undefined control sequence. \endkframe ...ip \endMakeFramed \at@end@of@kframe

l.91 \end{kframe} nhijl

2)

! LaTeX Error: \begin{document} ended by \end{kframe}. l.91 \end{kframe} nhijl

Can you help me?

• – scottkosty Jun 2 '15 at 19:00
• You might need label too, something like this << label = Test, echo = TRUE, results = 'asis' >>=. – MYaseen208 Jun 3 '15 at 15:17