0

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 
con <- dbConnect(MySQL(),user="xxx", password="xxx",dbname="xxx", host="xxx") 

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

Your command was ignored.

Can you help me?

1

first of all, thank you for your suggestions.

I solved the problem by writing the same script directly into lyx.

Is it possible that by copying and pasting the original script from R into lyx, some "invisible rubbish" could have been included and finally caused trouble?

| improve this answer | |
  • You might need to paste with ctrl + shift + v, instead of ctrl + v. See the Edit > Paste menu. – scottkosty Sep 6 '15 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.