Skip to content
Back to formatted view

Raw Message

Message-ID: <1406903881.69434.YahooMailNeo@web142606.mail.bf1.yahoo.com>
Date: 2014-08-01T14:38:01Z
From: arun
Subject: How to transform the data frame into the list?

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?