[R] Choice of data.frame column by index?

Johannes Graumann johannes_graumann at web.de
Thu Aug 23 11:56:20 CEST 2007


Hello,

Imagine a data frame like so:

  Intensity0 Intensity1
1   767432.1   451743.4
2  3998988.0  4642145.0
3   818974.6   552315.8

and a vector like so:

[1] 1 2 1

How can I get R to produce a vector that contains the value in one column or
the other depending on the vector? The result should look like

[1] 767432.1 4642145.0 818974.6

Thanks for any hints!

Joh



More information about the R-help mailing list