Thank you very much for your response. Sorry because I did not check carefully my R code.
I've heard about knitr several weeks ago but haven't tried it yet because Sweave is somehow more familiar to me; however, I intend to try it in near future. Best regards, Lam PK -----Original Message----- From: Scott Kostyshak [mailto:[email protected]] Sent: Thursday, May 31, 2012 11:36 AM To: Lam Phung Khanh; [email protected] Subject: RE: LyX cannot handle '$' sign in Sweave code chunk From: Lam Phung Khanh [[email protected]] Sent: Wednesday, May 30, 2012 10:54 PM Note that I used knitr to test this, not Sweave. knitr is newer, has more features, and can do everything that Sweave can and a lot more. To use it, add the module Rnw (knitr) instead of Sweave. Is there a reason you want to use Sweave? >I got error: "LyX: cannot convert file" when compiled it. My suspect is LyX cannot handle the '$' sign in Sweave >code chunk. When I used another way to write the last code line, it worked fine: I don't think this is a LyX or a knitr error but a problem with your R code. R gives me the following error: a <- c(1:10) b <- c(11:20) d <- cbind(a, b) d$a Error in d$a : $ operator is invalid for atomic vectors The following runs fine for me in R and in LyX + knitr a <- c(1:10) b <- c(11:20) d <- data.frame(a, b) d$a >Please forgive me if this email disturbs you. Of course not! Feel free to ask any question about LyX + knitr. Scott
