Displaying 2 results from an estimated 2 matches for "indicator_rating".
2010 Feb 24
1
extracting results from wilcox_test (package::coin)
Recently, I ran a series of Kruskal-Wallace tests [kruskal.test()] using by()
to group by site Output is a list:
>Herb.KW
Herb.df$ID: 10-1
Kruskal-Wallis rank sum test
data: Indicator_Rating by Year
Kruskal-Wallis chi-squared = 15.24, df = 7, p-value = 0.03302
-----------------------------------------------------------------------------------------------------
Herb.df$ID: 18-1
Kruskal-Wallis rank sum test
data: Indicator_Rating by Year
Kruskal-Wallis chi-squared = 13.56,...
2010 Jan 27
2
using functions with multiple arguments in the "apply" family
...wever, my data has multiple sites on which KW needs to be run...
here's the data:
Herb.df<-
data.frame(Score=rep(c(2,4,6,6,6,5,7,8,6,9),2),Year=rep(c(rep(1,5),rep(2,5)),2),Site=c(rep(3,10),rep(4,10)))
However, if I try this:
tapply(Herb.df,Herb.df$Site,function(.data)
kruskal.test(.data$Indicator_Rating,.data$Year))
>Error in tapply(Herb.df, Herb.df$ID, function(.data)
kruskal.test(.data$Indicator_Rating, :
arguments must have same length
How can I vectorize the kruskal.test() for all sites using tapply() in lieu
of a loop?
--
View this message in context: http://n4.nabble.com/usin...