Hi,
I am trying to add a column of numbers to a data frame in R with multiple
conditions.
Here is a simplified example df:
[A] [B] [C] [D] [E]
[1] 1 X 90 88
[2] 1 Y 72 70
[3] 1 Z 67 41
[4] 2 X 74 49
[5] 2 Y 42 50
[6] 2 Z 81 56
[7] 3 X 92 59
[8] 3 Y 94 80
[9] 3 Z 80 82
I would like column [E]
Hi Libby,
You had an accumulation of small errors, from an extra ) to an unclear
understanding of how indexing works in R. Also, you shouldn't call
your dataframe df, or use square brackets in column names.
That said, what about:
sampledata - structure(list(A = c(1L, 1L, 1L, 2L, 2L, 2L, 3L,
Gertken libb...@utexas.edu
Cc: r-help@r-project.org
Sent: Thursday, October 4, 2012 4:03 PM
Subject: Re: [R] R help - Adding a column in a data frame with multiple
conditions
Hi Libby,
You had an accumulation of small errors, from an extra ) to an unclear
understanding of how indexing works in R
3 matches
Mail list logo