Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

How to create dataframe subsets split by week? [duplicate]

$
0
0

This question already has an answer here:

I have data that looks like the following. I'm fairly new to programming and am not sure how to subset my data into variables that split the dataframes into divisions by week. I want to do it without having to type DataWeek1=Data[which(Data$Week==1),] 52 times. I assume I have to use a for loop of some kind, but am not sure how to do so?

      REGION YEAR WEEK 
1    Alabama 2010   40             
2     Alaska 2010   40              
3    Arizona 2010   40            
4   Arkansas 2010   40              
5 California 2010   40               
6   Colorado 2010   40          

Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>