[R] Post for R

carrie wang yuemile0902 at yahoo.com
Thu Jun 1 04:48:28 CEST 2017


Hello, 
I want to split the dataframe into 1000 groups based on two column values(max value and second max value). First, I made two lists L1 and L2.  L1 is the list divided into 100 groups based on the range of max value and L2 is divided into 10 groups based on the second max values. Now I want to do the combinations based on L1 and L2. I want to do a for loop for L1 and for each element in L1, I split it into 10 groups based on L2. I tried to write the code, but it does not work.

L1<-split(df,cut(df$max,seq(0,1,by=0.01)))L2<-split(df,cut(df$submax,seq(0,0.2,by=0.02)))
Z<-list()G<-list()for (i in length(L1)){  Z=data.frame(L1[i])  G <- split(Z$submax,"0.02")  print(G)  }
Thanks so much!Carrie
	[[alternative HTML version deleted]]



More information about the R-help mailing list