Skip to content

sweave quesiton

2 messages · Rafael A. Irizarry, Friedrich.Leisch@univie.ac.at

#
if i write a funciton like this

	f <- function(x) Sweave("report.Rnw")

and report.Rnw has an R chunk like this:
	
	<<>>=
	print(x)
	@

i get an error: 'Object "x" not found'. 

is there a way to avoid this
without using assign to create a global variable?

thanks,
rafael
#
> if i write a funciton like this
  > 	f <- function(x) Sweave("report.Rnw")

  > and report.Rnw has an R chunk like this:
	
  > 	<<>>=
  > 	print(x)
  > 	@

  > i get an error: 'Object "x" not found'. 

  > is there a way to avoid this
  > without using assign to create a global variable?

Not at the moment, because all Sweave evaluations are done in the
global environment.

.f