Hi,

Try to assign the names to your vector after having created it.
It works and it will also simplify your code.

Eric


my.group <- c("one group", "other group") class.weight <- c(1,2) my.order <- c(2,1) my.vector <- class.weight[my.order] names(my.vector) <- my.group

> my.vector
  one group other group
          2           1

At 10:58 29/03/2004, Christoph Lehmann wrote:
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

Eric Lecoutre UCL / Institut de Statistique Voie du Roman Pays, 20 1348 Louvain-la-Neuve Belgium

tel: (+32)(0)10473050
[EMAIL PROTECTED]
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre

If the statistics are boring, then you've got the wrong numbers. -Edward Tufte

______________________________________________
[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