Re: [R] Evaluating args in a function

2007-09-12 Thread Alberto Monteiro
Gabor Grothendieck wrote: > > You have a recursive reference. Try using a different name other > than class. For example, in the following we use class. with a dot > at the end > (so that abbreviation of it still allows the user to write class): > One year using R, and I hadn't known that I co

Re: [R] Evaluating args in a function

2007-09-12 Thread Duncan Murdoch
On 9/12/2007 12:48 PM, Sandy Weisberg wrote: > Can anyone explain what I'm doing wrong here: > > > fred <- data.frame() > > class(fred) > [1] "data.frame" > > test.fn <- function(x,class=class(x)) {class} > > test.fn(fred) > Error in test.fn(fred) : promise already under evaluation: recursive

Re: [R] Evaluating args in a function

2007-09-12 Thread Gabor Grothendieck
You have a recursive reference. Try using a different name other than class. For example, in the following we use class. with a dot at the end (so that abbreviation of it still allows the user to write class): fred <- data.frame() test.fn <- function(x,class.=class(x)) {class.} test.fn(fred) # "

[R] Evaluating args in a function

2007-09-12 Thread Sandy Weisberg
Can anyone explain what I'm doing wrong here: > fred <- data.frame() > class(fred) [1] "data.frame" > test.fn <- function(x,class=class(x)) {class} > test.fn(fred) Error in test.fn(fred) : promise already under evaluation: recursive default argument reference or earlier problems? R 2.5.1 on