I do not understand this.
I have the same problem and I tried to reproduce it thusly
Q <- 3
test <- function(q=Q){
cat(q, "\n")
}
> test()
3
Q <- 3
test <- function(q=Q){
test2(q, "\n")
}
test2 <- function(q, a){
cat(q, a)
}
> test()
3
Q <- 3
test <- function(q=Q){
z <- paste(q, "\n")
Many thanks Wacek, that is very helpful. Appreciate it.
Regards,
Tolga
Wacek Kusnierczyk <[EMAIL PROTECTED]>
25/11/2008 10:51
To
[EMAIL PROTECTED]
cc
R help <[EMAIL PROTECTED]>
Subject
Re: [R] "recursive default argument" error
[EMAIL PROTECTED] wrote:
> D
[EMAIL PROTECTED] wrote:
> Dear R Users,
>
> I have a function foo in a script with default values for some of the
> parameters as follows:
>
> testparams=list(a=1,b=2,c=3)
> foo<-function(x,y,testparams=testparams)
> x+y+testparams$a+testparams$b+testparams$c
>
>
> When I try to run foo(1
Dear R Users,
I have a function foo in a script with default values for some of the
parameters as follows:
testparams=list(a=1,b=2,c=3)
foo<-function(x,y,testparams=testparams)
x+y+testparams$a+testparams$b+testparams$c
When I try to run foo(1,2), I get the following error:
> testpara
4 matches
Mail list logo