[R] How to split data frame into groups by a list of factors?

Ted Zeng (曾振兴) zengzhenxing at gmail.com
Sun Jan 31 20:25:53 CET 2010


Dear R users:

I am dealing a data frame x as followings:

       Date trade_day      IV.b      IV.a
1 2003-03-02        19 0.1724818 0.1815687
2 2003-03-02        18 0.1733542 0.1763827
3 2003-03-02        19 0.1753308 0.1783653
4 2003-03-03        16 0.1751217 0.1781624
5 2003-03-03        16 0.1738580 0.1768961
6 2003-03-03        19 0.1733346 0.1763800
......

I want to split the data flame into groups according to the variable "Date"
and "trade_day"
I tried: split(x,f=list(a=x$Date,b=x$trade_day)), but it doesn't work. How
can I solve this problem?

Thanks advance

Ted
-- 
View this message in context: http://n4.nabble.com/How-to-split-data-frame-into-groups-by-a-list-of-factors-tp1458171p1458171.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list