Entering edit mode
Hi,
i have a dataset and want to run wilcox.test on it but i am getting
error
Error in wilcox.test.formula(organ8w$epiWAT ~ as.integer(group), data
=
organ8w) :
grouping factor must have exactly 2 levels
my code is,
head(organ8w)
Group Liver Spleen LV RV Gastrocnemicus
Soleus
rpWAT epiWAT BAT
1 Control 4.483974 0.2147436 0.3387821 0.06282051 1.0160256
0.06025641 0.8878205 3.304487 0.3717949
2 Control 4.593583 0.2754011 0.3438503 0.07219251 0.9812834
0.05882353 0.9224599 2.989305 0.4973262
3 Control 4.318792 0.2483221 0.3291946 0.06375839 0.9798658
0.05939597 0.7080537 2.667785 0.4530201
4 Control 4.400000 0.2933333 0.3490000 0.06766667 1.0700000
0.06300000 0.3766667 1.516667 0.2166667
5 Control 4.206406 0.2348754 0.3384342 0.07153025 0.9893238
0.06120996 0.7793594 2.754448 0.3843416
6 Control 4.323944 0.2887324 0.3802817 0.06373239 0.9577465
0.06161972 0.3591549 1.626761 0.2816901
organ8w$Group
[1] "Control" "Control" "Control" "Control" "Control" "Control"
"Control"
"Control" "Control" "HFD-ED" "HFD-ED" "HFD-ED" "HFD-ED" "HFD-ED"
"HFD-ED" "HFD-ED" "HFD-ED"
[18] "HFD-ED" "HFD-ED" "HFD-ED" "HFD-ED" "HFD-M" "HFD-M"
"HFD-M"
"HFD-M" "HFD-M" "HFD-M" "HFD-M" "HFD-M" "HFD-M" "HFD-M"
"HFD-M" "HFD-M"
group <- factor(organ8w$Group)
group
[1] Control Control Control Control Control Control Control Control
Control HFD-ED HFD-ED HFD-ED HFD-ED HFD-ED HFD-ED HFD-ED HFD-ED
HFD-ED HFD-ED HFD-ED HFD-ED
[22] HFD-M HFD-M HFD-M HFD-M HFD-M HFD-M HFD-M HFD-M
HFD-M
HFD-M HFD-M HFD-M
Levels: Control HFD-ED HFD-M
Mann-wit <- wilcox.test(organ8w$epiWAT~ as.integer(group), data=
organ8w)
Error in wilcox.test.formula(organ8w$epiWAT ~ as.integer(group), data
=
organ8w) :
grouping factor must have exactly 2 levels
Can someone help me with what is wrong in my code?
Also i have tried to run the same code by omitting NA â
na.omit(organ8w)
but getting the same results.
sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] sv_SE.UTF-8/sv_SE.UTF-8/sv_SE.UTF-8/C/sv_SE.UTF-8/sv_SE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gplots_2.13.0 plyr_1.8.1 ggplot2_1.0.0 XLConnect_0.2-7
loaded via a namespace (and not attached):
[1] bitops_1.0-6 caTools_1.17 colorspace_1.2-4
digest_0.6.4
gdata_2.13.3 grid_3.1.0 gtable_0.1.2
gtools_3.4.1
KernSmooth_2.23-12
[10] labeling_0.2 MASS_7.3-33 munsell_0.4.2
proto_0.3-10
Rcpp_0.11.2 reshape2_1.4 rJava_0.9-6
scales_0.2.4
stringr_0.6.2
[19] tools_3.1.0
Best regards,
Nikul
Chalmers Univ. Technology
Sweden
--
सरà¥à¤µà¥sतà¥à¤° सà¥à¤à¤¿à¤¨: सनà¥à¤¤à¥
सरà¥à¤µà¥ सनà¥à¤¤à¥ निरामया: |
सरà¥à¤µà¥ à¤à¤¦à¥à¤°à¤¾à¤£à¤¿ पशà¥à¤¯à¤¨à¥à¤¤à¥ मा
à¤à¤¶à¥à¤à¤¿à¤¤ दà¥:ठमापà¥à¤¨à¥à¤¯à¤¾à¤¤ ||
[[alternative HTML version deleted]]