[R] help in replacing for llop

R. Michael Weylandt michael.weylandt at gmail.com
Tue Mar 27 17:02:22 CEST 2012


No idea what a "mean median histogram" is but you may wish to check
out ?tapply or library(plyr), both of which are designed for this
split-apply-combine paradigm.

Michael

On Tue, Mar 27, 2012 at 12:51 AM, arunkumar1111 <akpbond007 at gmail.com> wrote:
> Hi
>
> I have records like like this
>
> X1      X2      State
> 34      72      state1
> 9       63      state1
> 49      31      state1
> 60      34      state1
> 80      73      state1
> 60      20      state2
> 59      87      state2
> 88      20      state2
> 71      66      state2
> 65      56      state2
> 59      16      state1
> 60      100     state2
>
>
> I want to get the summarize value like mean median histogram for X1 and X2
> based on state. I'm using FOR loop for this.  Is there any method to remove
> for loop and use apply or any alternatives
>
>
> -----
> Thanks in Advance
>        Arun
> --
> View this message in context: http://r.789695.n4.nabble.com/help-in-replacing-for-llop-tp4507939p4507939.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list