wilcox.test error
1
0
Entering edit mode
Nikul Soni ▴ 80
@nikul-soni-5917
Last seen 8.9 years ago
Sweden
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]]
• 6.9k views
ADD COMMENT
0
Entering edit mode
Axel Klenk ★ 1.0k
@axel-klenk-3224
Last seen 13 hours ago
UPF, Barcelona, Spain
Dear Nikul, I think the error message is pretty clear: grouping factor must have exactly 2 levels and your factor group has three levels: Levels: Control HFD-ED HFD-M so you'll have to decide which subgroups you want to compare or use kruskal.test() for more than two. (And of course this is not a BioC question and should be asked on R-help or StackOverflow or elsewhere...) Cheers, - axel On Tue, Jun 17, 2014 at 1:15 PM, Nikul Soni <soninikul007@gmail.com> wrote: > 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]] > > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Axel Klenk Research Informatician Information Management Drug Discovery Actelion Pharmaceuticals Ltd. • Gewerbestrasse 16 • CH-4123 Allschwil • Switzerland H91.O1.W01.2 axel.klenk@actelion.com • www.actelion.com Address for visitors: Hegenheimermattweg 91 -- The information of this email and in any file transmitted with it is strictly confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any copying, distribution or any other use of this email is prohibited and may be unlawful. In such case, you should please notify the sender immediately and destroy this email. The content of this email is not legally binding unless confirmed by letter. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company. For further information about Actelion please see our website at http://www.actelion.com [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 417 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6