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 factor on the function, which might be
the source of the problem)
4) if you can't figure what is wrong there - use "dput", and put that vector
on text, and e-mail it back so we could see if we can reproduce the error
and find a reason for it.
5) Report if you found a solution on yourself - so others would benefit from
your experience.

Cheers :)
Tal

----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Tue, Aug 3, 2010 at 2:47 PM, imrib <bisr...@agri.huji.ac.il> 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 <- function(x) anova(lm(plant.height ~ x))$"Pr(>F)"[1]
>
> r<- apply(g[,8:57],2,a)
>
> If I try to do a Kruskal-Wallis test :
>
> kw <- function(x) kruskal.test(plant.height ~ x)$"p.value"
>
> r.kw <- apply(g[,8:57],2,kw)
>
> I get the following error message:
>
> Error in kruskal.test.default(c(0.16, 0, 0.007, 0.078, 0, 0.08, 0.19,  :
>
> all group levels must be finite
>
> Why do I get this error ? (the values in c() are the plant.height values)
>
> Thanks
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Kruskal-Walllis-test-tp2311712p2311712.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to