Skip to content
Prev 58835 / 398502 Next

"<<-" assignment no long work in class methods

Gang Liang wrote:

            
Hi,

What (my guess) you want to define is:

setMethod( "incrXByOne", "myclass", function(obj) {obj at x <- obj at x + 1;obj})

You do not need "<<-" to assign to a function argument? Its in my view 
even erroneous.

This S code gives an error too.

test <- function(x)
{
x$bla<<-x$bla + 1
}
test(1)
Error in test(1) : Object "x" not found

/E