Dear All, I have been using Sweave (mainly via the Sweave.sh script) and really like it. I am working a paper (using Sweave, of course) which includes several time-consuming computations, and it gets tedious to re-compile the whoel thing every time I made changes. Then I discover the "cacheSweave" package, which seems the right solution to my problem. I only have on problem. Here is what I did: ---------------------------------------------- <<results=hide,echo=false>>library(foreign) library(Zelig) library(memisc) options(digits=4) @ <<echo=false>>d <- read.dta("~/project/abortion/data/data_transition_wide.dta") @ ... ---------------------------------------------- It can be compiled using "Sweave.sh foo.Rnw", but when I tried "Sweave.sh -c foo.Rnw", I got error message: "...Processing code chunks ... 1 : term hide Error in data.frame(chunk = options$label, chunkprefix = chunkprefix, : arguments imply differing number of rows: 0, 1" I thought it might be an imcompatibiltiy problem between the cacheSweave and the foreign packages, but the problem was still there when I tried to read the data in using "read.table" function. Any ideas? Many thanks. Best, Shige [[alternative HTML version deleted]]
Another thing you can do to save time is to use the --no-vignettes switch when you build the package. On Sat, Jul 25, 2009 at 11:05 PM, Shige Song<shigesong at gmail.com> wrote:> Dear All, > > I have been using Sweave (mainly via the Sweave.sh script) and really like > it. I am working a paper (using Sweave, of course) which includes several > time-consuming computations, and it gets tedious to re-compile the whoel > thing every time I made changes. Then I discover the "cacheSweave" package, > which seems the right solution to my problem. I only have on problem. Here > is what I did: > > ---------------------------------------------- > <<results=hide,echo=false>>> library(foreign) > library(Zelig) > library(memisc) > options(digits=4) > @ > > <<echo=false>>> d <- read.dta("~/project/abortion/data/data_transition_wide.dta") > @ > > ... > > ---------------------------------------------- > > It can be compiled using "Sweave.sh foo.Rnw", but when I tried "Sweave.sh -c > foo.Rnw", I got error message: > ?"...Processing code chunks ... > 1 : term hide > Error in data.frame(chunk = options$label, chunkprefix = chunkprefix, ?: > ?arguments imply differing number of rows: 0, 1" > > I thought it might be an imcompatibiltiy problem between the cacheSweave and > the foreign packages, but the problem was still there when I tried to read > the data in using "read.table" function. > > Any ideas? Many thanks. > > Best, > Shige > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Shige Song wrote:> > I have been using Sweave (mainly via the Sweave.sh script) and really like > it. I am working a paper (using Sweave, of course) which includes several > .... >To check what's wrong, please post a reproducible minimal example. It is difficult to guess if this has to do with the data frame or something else from your post. Dieter -- View this message in context: http://www.nabble.com/Sweave%2C-cacheSweave%2C-and-data-frame-tp24663644p24665116.html Sent from the R help mailing list archive at Nabble.com.
Shige Song wrote:> Dear All, > > I have been using Sweave (mainly via the Sweave.sh script) and really like > it. I am working a paper (using Sweave, of course) which includes several > time-consuming computations, and it gets tedious to re-compile the whoel > thing every time I made changes. Then I discover the "cacheSweave" package, > which seems the right solution to my problem. I only have on problem. Here > is what I did: >I can't help with your question, but another approach to do what you want is to have one script that does the time consuming calculations and saves the results (using save()) to a file, then have your Sweave document load() the object as necessary. You could then also move the read.dta() line to this other script, and load() that data, simplifying your Sweave document. Duncan Murdoch> ---------------------------------------------- > <<results=hide,echo=false>>> library(foreign) > library(Zelig) > library(memisc) > options(digits=4) > @ > > <<echo=false>>> d <- read.dta("~/project/abortion/data/data_transition_wide.dta") > @ > > ... > > ---------------------------------------------- > > It can be compiled using "Sweave.sh foo.Rnw", but when I tried "Sweave.sh -c > foo.Rnw", I got error message: > "...Processing code chunks ... > 1 : term hide > Error in data.frame(chunk = options$label, chunkprefix = chunkprefix, : > arguments imply differing number of rows: 0, 1" > > I thought it might be an imcompatibiltiy problem between the cacheSweave and > the foreign packages, but the problem was still there when I tried to read > the data in using "read.table" function. > > Any ideas? Many thanks. > > Best, > Shige > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >