Re: [R] Kruskal Walllis test

2010-08-03 Thread peter dalgaard
On Aug 3, 2010, at 1:47 PM, imrib wrote: > > Hi all > My data table (g) contains a continues data column (plant.height) and other > columns (columns 8 to 57), > > each with number of levels of different factors. ANOVA test was done and > the p-values were extracted > > as follos: > > a <-

Re: [R] Kruskal Walllis test

2010-08-03 Thread Wu Gong
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.characte

Re: [R] Kruskal Walllis test

2010-08-03 Thread Tal Galili
I would suggest to you the following: 1) Run the same thing, but with a loop instead of apply 2) add the to loop a printing that shows you on what cycle of the loop the function breaks 3) see if that vector has any Inf or NA values (although in general I think you are using a numeric instead of a f

[R] Kruskal Walllis test

2010-08-03 Thread imrib
Hi all My data table (g) contains a continues data column (plant.height) and other columns (columns 8 to 57), each with number of levels of different factors. ANOVA test was done and the p-values were extracted as follos: a <- function(x) anova(lm(plant.height ~ x))$"Pr(>F)"[1] r<- apply(g[