Thank you very much for this resource. I've tried and now seen the R error in the LyX messages.
Best regards, Lam PK -----Original Message----- From: xieyi...@gmail.com [mailto:xieyi...@gmail.com] On Behalf Of Yihui Xie Sent: Friday, June 01, 2012 11:41 PM To: Lam Phung Khanh Cc: Scott Kostyshak; lyx-users@lists.lyx.org Subject: Re: LyX cannot handle '$' sign in Sweave code chunk Please read the manual https://github.com/downloads/yihui/lyx/sweave.pdf to help you diagnose the problem; you should see the R error in the LyX messages. Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Thu, May 31, 2012 at 1:37 AM, Lam Phung Khanh <la...@oucru.org> wrote: > 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:skost...@princeton.edu] > Sent: Thursday, May 31, 2012 11:36 AM > To: Lam Phung Khanh; lyx-users@lists.lyx.org > Subject: RE: LyX cannot handle '$' sign in Sweave code chunk > > From: Lam Phung Khanh [la...@oucru.org] > 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