Hi all,

Here is my df and I want to make an averaged model of my variables based on 
Time like the following:

    
   $ Protocol   : Factor w/ 48 levels "DP FS QTSE SAG",..: 2 3 43 42 
   $ Time       : num  182 185 189 234 186 ... 

   $ Systemtype   : Factor w/ 2 levels "Aera XJ","AERA XQ": 1 1 1 
   $ ADJ        : Factor w/ 2 levels "auto","manu": 1 1 
   $ BR         : int  384 384 384 384 512 384
   $ TF         : int  10 10 13 7 7 5 5 
I split my df into quartiles for time,

   
   df$quant=findInterval(df$Time, quantile(df$Time), rightmost.closed=TRUE)
by the column df$quant I see quartiles 1 to 4 for time, next I want to create a 
new column for example for BR and if df$quant==1 then put mean of first 
quartile of BR in that,if df$quant==2 put mean of second quartile of BR in that 
and so on. I do the same for every numeric variable. Does anyone know how to 
that?


Thanks for any help!
Elahe

______________________________________________
R-help@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/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to