Dear R forum
I have a data.frame as
cashflow_df = data.frame(instrument =
c(ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,
ABC, PQR, PQR, PQR,PQR,PQR,PQR,PQR,PQR,PQR,PQR, PQR,
PQR, PQR,PQR, PQR,PQR,PQR,PQR, PQR,PQR,UVWXYZ,UVWXYZ,
UVWXYZ, UVWXYZ, UVWXYZ,UVWXYZ,UVWXYZ,UVWXYZ, UVWXYZ,
If this is a homework problem, there is a no homework policy on this list.
-- Bert
On Mon, Apr 29, 2013 at 5:24 AM, Katherine Gobin
katherine_go...@yahoo.com wrote:
Dear R forum
I have a data.frame as
cashflow_df = data.frame(instrument =
, April 29, 2013 8:24 AM
Subject: [R] Adding elements in data.frame subsets and also subtracting an
element from the rest elements in data.frame
Dear R forum
I have a data.frame as
cashflow_df = data.frame(instrument =
c(ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,
ABC, PQR, PQR
AM
Subject: Re: [R] Adding elements in data.frame subsets and also subtracting an
element from the rest elements in data.frame
Hi Katherine,
res1-aggregate(cbind(cashflow,cashflows_pv)~instrument+id,data=cashflow_df,sum)
res2-res1[order(res1$instrument),]
res2$cashflow_change-with(res2,ave
4 matches
Mail list logo