HI,
May be this helps:
library(reshape2)
df1 <- dcast(DF,A2~A1,value.var="A3")
z <- function(a,b,c){a+2*b+c}
within(df1, newCol <- z(a,b,c))
# A2 a b c newCol
#1 m 1 4 7 16
#2 n 2 5 8 20
#3 p 3 6 9 24
On Tuesday, January 7, 2014 4:15 PM, Ron Michael
wrote:
Hi,
I have to
On 14-01-07 3:21 PM, Ron Michael wrote:
Hi,
I have to perform some formula driven calculation in a data.frame (as defined
below). Let say I have following DF:
DF <- data.frame(A1 = c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), A2 =
c('m', 'n', 'p', 'm', 'n', 'p', 'm', 'n', 'p'), A3 = c(1,2
Hi,
I have to perform some formula driven calculation in a data.frame (as defined
below). Let say I have following DF:
> DF <- data.frame(A1 = c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'), A2 =
> c('m', 'n', 'p', 'm', 'n', 'p', 'm', 'n', 'p'), A3 = c(1,2,3,4,5,6,7,8,9))
> DF
A1 A2 A3
1 a
3 matches
Mail list logo