Dear list,
I have a problem with the cumsum function.
I have a data frame like the following one
variableYear value
EC01 2005 5
EC01 2006 10
AAO12005 2
AAO1 2006 4
what I would like to obtain is
See ?split and ?unsplit.
Data - read.table(textConnection(variableYear value
EC01 2005 5
EC01 2006 10
AAO12005 2
AAO1 2006 4),header=T)
Datalist -split(Data,Data$variable)
resultlist -
-project.org
Sent: Thu, June 3, 2010 9:26:17 AM
Subject: Re: [R] cumsum function with data frame
See ?split and ?unsplit.
Data -
read.table(textConnection(variable Year
value
EC01 2005
5
EC01 2006
10
AAO1
2005 2
AAO1
,CUMSUM=cumsum(value))
- Original Message
From: Felipe Carrillo mazatlanmex...@yahoo.com
To: Joris Meys jorism...@gmail.com; n.via...@libero.it
n.via...@libero.it
Cc: r-help@r-project.org
Sent: Thu, June 3, 2010 11:28:58 AM
Subject: Re: [R] cumsum function with data frame
You can
...@gmail.com; n.via...@libero.it
n.via...@libero.it
Cc: r-help@r-project.org
Sent: Thu, June 3, 2010 11:28:58 AM
Subject: Re: [R] cumsum function with data frame
You can also use ddply from the plyr package:
library(plyr)
Data -
read.table(textConnection(variableYear value
: [R] cumsum function with data frame
You can also use ddply from the plyr package:
library(plyr)
Data -
read.table(textConnection(variable Year value
EC01
2005 5
EC01 2006 10
AAO1 2005
2
AAO1 2006
4),header=T)
Data
ddply
-help@r-project.org;r-help@r-project.org
Sent: Thu,
June 3, 2010 9:26:17 AM
Subject: Re: [R] cumsum function with data
frame
See ?split and ?unsplit.
Data -
read.table(textConnection(variableYear
value
EC01
2005
5
EC012006
7 matches
Mail list logo