Skip to content

differences in using source() or console

2 messages · vito muggeo, Duncan Murdoch

#
Dear all,
Is there *any* reason explaining what I describe below?
I have the following line

myfun(x)

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


====================================
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
#
On 12/6/2007 8:01 AM, vito muggeo wrote:
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.

Duncan Murdoch