[R] Nested source()s

Rolf Turner rolf at math.unb.ca
Mon Jul 12 13:45:32 CEST 2004


Murray Jorgensen wrote:

> I had an error message while running a macro from Yudi Pawitan's web site:
> 
>  > source("ex2-13.r")
> Error in parse(file, n, text, prompt) : syntax error on line 2
> 
> Inspecting ex2-13.r I found that the error was generated by another 
> source() command.
> 
> Clearly R does not like nested source()s, which is fair enough when you 
  ^^^^^^^
  |||||||
  Nothing clear about it!

> think about it. Still it's something that you might want to do. Does 
> anyone know how to get achieve the substance of what nested source() 
> commands would give you?

	You're leaping to conclusions, mate.  There is no
	proscription of nested sources in R.  I just checked
	this:  I built a file called ``melvin'':

	x <- 42
	source('clyde')

	and a file called ``clyde'':

	y <- 2*x
	print(y)

	and then executed

	> source('melvin')

	and got

	[1] 84

	OMMMMMMMMMMMMMMMMMMMMMMM.

	There is something else wrong in the files that you
	are sourcing.

					cheers,

						Rolf
						rolf at math.unb.ca




More information about the R-help mailing list