Consider the data.frame:
df - data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C =
c(2,7,5,2,7,4,5), index = c(A,B,A,C,B,B,C))
I want to select the column specified in 'index' for every row of 'df', to
get
goal - c(1, 7, 2, 2, 3, 5, 5)
This sounds a lot like the indexing-by-a-matrix you
On Thu, Apr 5, 2012 at 1:40 PM, Peter Meilstrup
peter.meilst...@gmail.com wrote:
Consider the data.frame:
df - data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C =
c(2,7,5,2,7,4,5), index = c(A,B,A,C,B,B,C))
I want to select the column specified in 'index' for every row of 'df', to
get
Le jeudi 05 avril 2012 à 12:40 -0700, Peter Meilstrup a écrit :
Consider the data.frame:
df - data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C =
c(2,7,5,2,7,4,5), index = c(A,B,A,C,B,B,C))
I want to select the column specified in 'index' for every row of 'df', to
get
goal - c(1,
3 matches
Mail list logo