On 16/11/2012 2:26 PM, Bush, Daniel P. DPI wrote:
I'm trying to use Sweave to create a dynamic report of a variety of financial 
data checks. I have an .R code file to pull the data from a database, 
manipulate and filter it, and create individual data frames for each test. My 
Sweave .RNW document then calls that file with source() to generate the data 
for the report. The .R file works fine on its own, but when I run it from 
within the Sweave document I get the following error message:

Error in .subset(x, j) : only 0's may be mixed with negative subscripts

Again, the .R code works perfectly well on its own--I only get the error when 
calling it through Sweave. Is there some quirk to Sweave that certain functions 
don't work properly?

No, it's a pretty standard evaluation environment. However, it may be running R without some functions that exist in your workspace when you source the script within an R session. It's also possible (but doesn't seem likely) that RStudio is causing some problems; you could try running "R CMD Sweave yourdoc.Rnw" from the command line, outside of Rstudio, to see if that makes a difference.

Duncan Murdoch

I am using the built-in Sweave function within RStudio 0.97.168.

DB

Daniel Bush
School Finance Consultant
School Financial Services
Wisconsin Department of Public Instruction
PO Box 7841 | Madison, WI 53707-7841
daniel.bush -at- dpi.wi.gov | sfs.dpi.wi.gov
Ph: 608-267-9212 | Fax: 608-266-2840

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to