I have the following data.frame. See an example of the first few lines and attributes.
SubPop Origin grid_code
AL 2008 4.730380
AL 2008 5.552315
AL 2008 5.968850
AL 2008 5.128384
AL 2009 6.927450
AL 2009 7.135734
ALCentral 2008 7.381087
ALCentral 2008 6.232927
ALCentral 2009 6.431800
ALCentral 2009 6.690246
ALCentral 2009 6.794144
I'd like to know how to split this data.frame into unique groups of the combinations of the attributes SubPop and Origin. For example, the whole data.frame has a unique set of 48 combinations of SubPop and Origin.
That said, I'd like to have as my final output, 48 lists, and each list would only have the attributes of that group. Example: The first group "AL and 2008" would have all the entries of my dataframe that have the SubPop=Al and Origin=2008. And so on...
> unique<-unique(df[,c("SubPop", "Origin")])
> unique<-unique[order(unique$SubPop, unique$OriginT),]
> df_split<-split(df, unique)
With this code, I can find the unique combination of attributes, but the splitting process has randomly assigned attributes to groups.
Sorry if it's confusing...