[R] Which method is called in command like "class(x)='something'"?

blue sky bluesky315 at gmail.com
Mon Feb 15 18:07:16 CET 2010


> x=3
> `class<-`(x,'something')#this command prints
[1] 3
attr(,"class")
[1] "something"
> x=3
> class(x)='something'#this command doesn't print anything

The first of the above two commands print the content of 'x' but the
second doesn't, although both of them set the argument 'x'. I'm
wondering which is method is called in the latter one.



More information about the R-help mailing list