r-help@r-project.org
Sent: Tuesday, June 4, 2013 12:37 AM
Subject: Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data
On Jun 3, 2013, at 7:10 PM, arun wrote:
Hi,
May be this helps:
res1-df1[with(df1,unlist(tapply(var,list(subid),FUN=function(x)
c(FALSE,diff(x)!=0
2 rows in 1 dataframe for diff - longitudinal data
On Jun 3, 2013, at 7:10 PM, arun wrote:
Hi,
May be this helps:
res1-df1[with(df1,unlist(tapply(var,list(subid),FUN=function(x)
c(FALSE,diff(x)!=0)),use.names=FALSE)),]
res1
# subid year var
#3 36 2003 3
#7 47 2001 3
: David Winsemius dwinsem...@comcast.net
To: arun smartpink...@yahoo.com
Cc: R help r-help@r-project.org
Sent: Tuesday, June 4, 2013 11:13 AM
Subject: Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data
On Jun 3, 2013, at 9:51 PM, arun wrote:
If it is grouped by subid (that would
- Original Message -
From: David Winsemius dwinsem...@comcast.net
To: arun smartpink...@yahoo.com
Cc: R help r-help@r-project.org
Sent: Tuesday, June 4, 2013 11:13 AM
Subject: Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data
On Jun 3, 2013, at 9:51 PM, arun wrote
Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of arun
Sent: Tuesday, June 04, 2013 10:19 AM
To: R help
Subject: Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data
Hi,
May be this helps:
res1-df1[with(df1,unlist(tapply(var,list(subid),FUN=function(x)
c(FALSE,diff(x)!=0)),use.names=FALSE)),]
res1
# subid year var
#3 36 2003 3
#7 47 2001 3
#9 47 2005 1
#10 47 2007 3
#or
library(plyr)
On Jun 3, 2013, at 7:10 PM, arun wrote:
Hi,
May be this helps:
res1-df1[with(df1,unlist(tapply(var,list(subid),FUN=function(x)
c(FALSE,diff(x)!=0)),use.names=FALSE)),]
res1
# subid year var
#3 36 2003 3
#7 47 2001 3
#9 47 2005 1
#1047 2007 3
#or
-
From: David Winsemius dwinsem...@comcast.net
To: arun smartpink...@yahoo.com
Cc: R help r-help@r-project.org
Sent: Tuesday, June 4, 2013 12:37 AM
Subject: Re: [R] Read 2 rows in 1 dataframe for diff - longitudinal data
On Jun 3, 2013, at 7:10 PM, arun wrote:
Hi,
May be this helps:
res1
8 matches
Mail list logo