I'm solving a task in Andy's Discovering Statistics using R. It's about gender and arousal for certain films. The data frame used is called chickFlick
, and it looks as follows:
gender film arousal
1 Male Bridget Jones' Diary 22
2 Male Bridget Jones' Diary 13
3 Male Bridget Jones' Diary 16
4 Male Bridget Jones' Diary 10
5 Male Bridget Jones' Diary 18
6 Male Bridget Jones' Diary 24
When I executed this command:
> cor.test(chickFlick$gender,chickFlick$arousal)
It returned:
Error in cor.test.default(chickFlick$gender, chickFlick$arousal) :
'x' must be a numeric vector
However, I was doing exactly what the answer key says. I could change the gender levels into 0s and 1s, but the textbook doesn't say it's necessary. What went wrong?