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
Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Franckx Laurent Sent: Mittwoch, 29. Mai 2013 13:49 To: 'r-help@r-project.org' Subject: [R] adding class attributes to strings: works in a loop, but not directly Dear all I try to a

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

2013-05-29 Thread Franckx Laurent
Dear all I try to assign class attributes to strings. Depending on the approach I use, it works (including method dispatch) or fails. Let me clarify with an example. Let: > AONtptmodelist <- c("FOOT","BICY") When I assign "class" attributes directly to these strings, it fails: > class("BICY