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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.