ing that can do this, I guess not possible.
>
> Thank you
>
> John
>
>
>
>
>
> From: Phil Spector
>
> Cc: r-help@r-project.org
> Sent: Fri, October 1, 2010 10:58:55 AM
> Subject: Re: [R] add a new column to data frame
>
> Here are two ways:
is, I guess not possible.
Thank you
John
From: Phil Spector
Cc: r-help@r-project.org
Sent: Fri, October 1, 2010 10:58:55 AM
Subject: Re: [R] add a new column to data frame
Here are two ways:
dat0 = subset(dat,time==0)
one = as.data.frame(as.table(
Here are two ways:
dat0 = subset(dat,time==0)
one = as.data.frame(as.table(by(dat0,dat0$id,
function(x)as.character(x$mode)[which.max(x$y)])))
names(one) = c('id','type')
merge(dat,one)
two = sapply(split(dat0,dat0$id),
function(x)as.character(x$mode)[which.max(
3 matches
Mail list logo