[R] How to transform the data frame into the list?
arun
smartpink111 at yahoo.com
Fri Aug 1 16:38:01 CEST 2014
Use ?split()
split(dat[,-4], dat$Year_Month) #dat is the dataset.
A.K.
Country Product Price Year_Month
AE 1 20 201204
DE 1 20 201204
CN 1 28 201204
AE 2 28 201204
DE 2 28 201204
CN 2 22 201204
AE 3 28 201204
CN 3 28 201204
AE 1 20 201205
DE 1 20 201205
CN 1 28 201205
AE 2 28 201205
DE 2 28 201205
How to create the list? which has:
[[201204]]
Country Product Price
AE 1 20
DE 1 20
CN 1 28
AE 2 28
DE 2 28
CN 2 22
AE 3 28
CN 3 28
[[201205]]
Country Product Price
AE 1 20
DE 1 20
CN 1 28
AE 2 28
DE 2 28
More information about the R-help
mailing list