Re: [R] adding class attributes to strings: works in a loop, but not directly

2013-05-29 Thread Franckx Laurent
method dispatch. Regards Laurent -Original Message- From: Blaser Nello [mailto:nbla...@ispm.unibe.ch] Sent: woensdag 29 mei 2013 15:56 To: Franckx Laurent; r-help@r-project.org Subject: RE: [R] adding class attributes to strings: works in a loop, but not directly There are two separate

Re: [R] adding class attributes to strings: works in a loop, but not directly

2013-05-29 Thread Jeff Newmiller
a) You cannot assign attributes to literal values such as "BICY". You must assign them to variables, as in x <- "BICY" class(x) <- "AONmode" b) You cannot give the separate elements of a vector their own separate attributes unless the vector is of mode "list". Ordinarily, attributes apply to th

Re: [R] adding class attributes to strings: works in a loop, but not directly

2013-05-29 Thread Blaser Nello
There are two separate issues that seem to be unclear. Concerning the class assignment: You cannot assign a class to a character string. You can assign a class to an object that contains a character string: > a <- "b" # ok > class(a) <- "AONmode" # not ok > class("b") <- "AONmode" Error in class(