[R] Post for R

Hasan Diwan hasan.diwan at gmail.com
Thu Jun 1 08:04:01 CEST 2017


Carrie,
I would suggest a few things before posting your code here:
- Put a dput(df)
- Format it properly, as it stands it won't compile, because you're missing
newlines/semicolons between, e.g. Z <- list()*; *G <- list(); for (i in
length(L1)){  Z=data.frame(L1[i])*;* G <- split(Z$submax,"0.02")*;*
 print(G)  }
-- H

On 31 May 2017 at 19:48, carrie wang via R-help <r-help at r-project.org>
wrote:

>
> 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(d
> f$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]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.




-- 
OpenPGP: https://sks-keyservers.net/pks/lookup?op=
get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using http://bit.ly/
hd1ScheduleRequest.
Si vous voudrais faire connnaisance, allez a http://bit.ly/
hd1ScheduleRequest.

<https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1>Sent
from my mobile device
Envoye de mon portable

	[[alternative HTML version deleted]]



More information about the R-help mailing list