[R] tapply confusion

David Winsemius dwinsemius at comcast.net
Thu Aug 30 17:00:59 CEST 2012


On Aug 30, 2012, at 4:02 AM, andyspeak wrote:

> Hello
> Thankyou for the help.
>
> kruskal.test(Temp, Roof)   is simple but just returns one result for  
> the
> whole temperature dataset organised by roof.
>
> I want to compare the Temp data for each Roof in each Month.  So  
> because i
> have temperature data on the three roofs for 16 different months  
> then i want
> 16 separate kruskal.test results.,
>

lapply( split(dfrm, dfrm$Month), function(xfrm) {
                  kruskal.test(xfrm[["Temp"]], xfrm[["Roof"]] }

Notice that I used an assumed name for the dataframe. You have  
apparently been following unwise advice to use attach. You would be  
advised to disregard that advice.

-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list