[R] Kruskal Walllis test
Wu Gong
wg2f at mtmail.mtsu.edu
Tue Aug 3 17:26:23 CEST 2010
The apply function coerces the factor results to a character array
apply(g,2,class) # gives character
The kruskal.test function doesn't take character vector as the group
argument.
kruskal.test(as.character(plant.height) ~ as.character(g[,8])) #doesn't work
kruskal.test(plant.height ~ as.character(g[,8])) #doesn't work
kruskal.test(as.character(plant.height) ~ g[,8]) #works
You'd better change the kw function.
kw <- function(x) kruskal.test(plant.height ~ as.factor(x))$"p.value"
-----
A R learner.
--
View this message in context: http://r.789695.n4.nabble.com/Kruskal-Walllis-test-tp2311712p2312063.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list