user2961556
user2961556

Reputation: 13

Error in wilcox.test : object 'x' not found

I'm trying to complete a mann-whitney-wilcoxon test in R to compare brood sizes between 2 years. My data read in successfully in 2 columns, labeled x and y for each year, ranked, with unequal sample sizes. I'm getting the following error and I'm not sure what the problem is.

setwd('c:/OSPR NEST 2011 & 2012')
penob1112<-read.csv('compare_penob_11_12.csv',header=TRUE)

wilcox.test(x, y, data=penob1112)
Error in wilcox.test(x, y, data = penob1112) : object 'x' not found

Thanks for any insights!

Upvotes: 1

Views: 1978

Answers (1)

Se&#241;or O
Se&#241;or O

Reputation: 17412

The data argument is only taken when the first argument is of class formula. You need to explicitly call each object instead:

wilcox.test(penob1112$x, penob1112$y)

Look at ?wilcox.test - it has two methods (default and formula)

Upvotes: 1

Related Questions