Michelle Emily DePrenger-Levin wrote:> Hello,
>
> I'm trying to compare the allozyme data from two taxa. I have several
> columns of data (19 loci) for each species. I want to do a Mann-Whitney
> U-test or the wilcox.test (two sample Wilcoxon). When I try to run my code
> (the first two columns are 1:name of the species, 2:name of individual) I
> get the error message:
> "Error in wilcox.test.default(CaScSc, CaScCo, alternative
= "
> two.sided", :
> 'x' must be numeric"
>
> I do have several NAs in the data which is all I can figure that is
> non-numeric.
>
No that's not it.> Any suggestions as to the problem? Is it a problem with having several
> columns/sets of info for each individual?
>
>
Yes, that is it. A data frame with 19 variables is not a numeric vector.
You need to do this column by column, or automate it explicitly via a
for-loop, or (better) lapply() or maybe mapply().
> Thanks for any help anyone can give (I've also used Arlequin and GDA
but
> want non-parametric tests)
>
> Michelle DePrenger-Levin
>
> My code is:
>
> scirconv2 = read.csv("CaScSc070420_2.csv",
na.strings="?")
>
>
> CaScSc = scirconv2[1:250,3:21]
> CaScCo = scirconv2[251:475,3:21]
> ScCoMWU = wilcox.test(CaScSc, CaScCo, alternative = "two.sided",
mu = 0.5,
> paired = FALSE, exact = NULL, correct = TRUE,
> conf.int = TRUE, conf.level = 0.95)
>
> some of the data:
>
> ADH TPI1 TPI2 SOD DIA1 MNR1DIA2 MNR2DIA3 ME AAT1 AAT2 G3PDH SDH SDH2
> PGI2 PGD PGM2 MDH1 MDH3 IDH2
> 251 1 1 1 1 1 1 1 1 1 1 1 1 1
> 2 1 4 1 1 4
> 252 NA NA NA NA NA NA 1 NA NA 2 1 1 NA
> 2 NA NA NA NA NA
> 253 1 1 1 1 1 1 2 1 1 2 1 1 1
> 2 1 4 1 2 4
> 254 1 1 1 1 1 1 1 1 1 1 1 1 1
> 2 1 4 1 1 4
> 255 1 1 1 1 1 1 2 1 1 2 1 1 1
> 2 1 4 1 2 4
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>