[R] differences in using source() or console
murdoch at stats.uwo.ca
Thu Dec 6 19:11:15 CET 2007
On 12/6/2007 8:01 AM, vito muggeo wrote:
> Dear all,
> Is there *any* reason explaining what I describe below?
Probably, but you're unlikely to get a correct explanation if you don't
give us code to reproduce the problem.
From the look of things, your real example is quite complex, which is
probably why you didn't post it. But the very act of simplifying it to
something that is reasonable to post is quite likely to reveal to you
what the problem is.
> I have the following line
> If I type them directly in R (or copy/past), it works..
> However if I type in R 2.6.1
> > source("code.R") ##code.R includes the above line
> Error in inherits(x, "data.frame") : object "d" not found
> namely myfun() does not work correctly.
> In particular the non-working line inside myfun() is
> update(eval(x$call$obj), data=d) #d is created in myfun()
> My question is: why the problem occurs just via source()ing???
> many thanks,
> Vito M.R. Muggeo
> Dip.to Sc Statist e Matem `Vianelli'
> Università di Palermo
> viale delle Scienze, edificio 13
> 90128 Palermo - ITALY
> tel: 091 6626240
> fax: 091 485726/485612
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help