Christoph, yes there IS a way, such as the horrible

eval(parse(text=paste("c(", my.group[1],
  " = ", class.weight[2], ",", my.group[2], " = ", class.weight[1], ")", sep="")))

BUT I would suggest you rethink whether there isn't a an altogether
more straightforward way to do what you want. For example, 

tmp <- class.weight
names(tmp) <- my.group

HTH

> -----Original Message-----
> From: Christoph Lehmann [mailto:[EMAIL PROTECTED]
> Sent: 29 March 2004 09:58
> To: [EMAIL PROTECTED]
> Subject: [R] c() question
> 
> 
> Security Warning: 
> If you are not sure an attachment is safe to open contact 
> Andy on x234. 
> There are 0 attachments with this message. 
> ________________________________________________________________ 
>  
> Hi
> 
> I need to define the following
> 
>       c("one group" = class.weight[2], "other group" = 
> class.weight[1])
> #class.weight = c(1,2)
> 
> but I don't like the hard-coded way and would like to use
> 
>       my.group <- array(c("one group", "other group"))
> 
> but now
> 
>       c(my.group[1] = class.weight[2], my.group[2] = class.weight[1])
> 
> gives an error
> 
> how can I solve this small problem?
> 
> thanks for a hint
> 
> christoph
> 
> -- 
> Christoph Lehmann <[EMAIL PROTECTED]>
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>  
 
Simon Fear 
Senior Statistician 
Syne qua non Ltd 
Tel: +44 (0) 1379 644449 
Fax: +44 (0) 1379 644445 
email: [EMAIL PROTECTED] 
web: http://www.synequanon.com 
  
Number of attachments included with this message: 0 
 
  
This message (and any associated files) is confidential and\...{{dropped}}

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to