I have data that is like the following (Except that is populated by all 52 weeks). "data"
Week State Value
1 CA 4
1 AL 5
1 MO 9
1 IL 12
2 NY 1
2 CA 2
2 WA 8
3 WY 9
3 SC 10
I would like to create new data.frames for every week so that I may do further analyses. How would I go about this? I tried:
for( i in 1:52) {
DataWeeki <- data[which(data$Week==i),]
}
This creates a single dataframe of 3 variables (with the appropriate variable names) but no data.
What is the correct way to go about this?