sahar_nokc
2013-Sep-20 09:43 UTC
[R] Access of odfWeave function to variables that are defined inside a function
Hi everyone! I have now been using odfWeave() for a while in order to make some word document reports of my data. I have encountered a problem when I try to organize my program script into some functions. It seems that if I use the odfWeave() within a function, then odfWeave() is not able to access the variables that are defined inside the body of the same function that runs odfWeave(). Here is a simple example of what I mean: report.year <- function(){ year=2011 odfWeave(sourcefile,outputfile) } report.year() When I run report.year(), I get the error message: object 'year' not found However, if I define the year out of the body of the function where I run report.year(), then I don't get such error and I can produce my report. I am wondering if this is something expected when using odfWeave due to its nature of being able to only access the variables on the first level, or should I somehow give access to the variables that are defined in the higher levels (I mean within the body of my functions)? I would actually like to report some of the variables that can only be defined within this function, is there any way of doing it inside the body of my report.year() function? I appreciate it a lot if anyone can give me some hint about what I can do in order to correct for this. Best regards, Sahar -- View this message in context: http://r.789695.n4.nabble.com/Access-of-odfWeave-function-to-variables-that-are-defined-inside-a-function-tp4676562.html Sent from the R help mailing list archive at Nabble.com.