Hello,
I apologise in advance for this question; I'm sure it is answered in
the documentation or this mailing list many times, however the answer
has eluded me.
I'm trying to write a function where I don't want external variables
to be scoped in from the parent environment. Given this
environment(test_func) - baseenv()
will allow it to access the base environment so it can still find exists
but will not find kat. If you issue the command
search()
then each attached package has the next as its parent and base is the
last one.
Regarding your second question, try rm().
f -
Hi,
I was wondering if there is a way to stop R looking outside the scope of
a function, if it can't find the variable inside the function.
I seem to waste hours debugging functions only to find I've used a wrong
variable name somewhere, but the function still works because the
variable
Use local or codetools package as in:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/69694.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/69695.html
On 4/12/06, James Kirkby [EMAIL PROTECTED] wrote:
Hi,
I was wondering if there is a way to stop R looking outside the scope of
a
On Wed, 12 Apr 2006, James Kirkby wrote:
Hi,
I was wondering if there is a way to stop R looking outside the scope of
a function, if it can't find the variable inside the function.
I seem to waste hours debugging functions only to find I've used a wrong
variable name somewhere, but the
On 4/12/2006 5:49 AM, James Kirkby wrote:
Hi,
I was wondering if there is a way to stop R looking outside the scope of
a function, if it can't find the variable inside the function.
I seem to waste hours debugging functions only to find I've used a wrong
variable name somewhere, but the
On Sat, 27 Mar 2004 07:08:09 -0800 (PST), Fred J. [EMAIL PROTECTED]
wrote :
The normal way would be to define builddl() within
getdata(), i.e.
getdata - function(p){
builddl - function(q,s){
fname - c(fname,s)
dl - list( dl, q)
}
fname - NULL; dl - list(NULL)#build the
Hello
getdata - function(p){
fname - NULL; dl - list(NULL)#build the sturcture
dt - read.csv(file.path(d,i),header=F) #data frame
ret - builddl(dt,s) #where s is a string
}
how can I get this following function to use fname and
dl from the above function without passing them down
the