0

I'm working with circular data in R for the first time and I'm running into an issue with doing a Dunn's test. I ran a Kruskal-Wallis on the same variables and it worked fine. I checked to make sure the bedtime_WD variable was numeric using the class() function and it came back as "circular" "numeric". Is there a reason I can't do the Dunn's test on this data?

The bedtime_WD variable is reported as 1.15, 0.67, 3.43, etc. Gender is reported as "F" or "M".

dunn.test(bedtime_WD,gender)
Error in dunn.test(bedtime_WD, gender) : 
  x must contain a numeric vector of data values, or a list of numeric data vectors.
  • `dunn.test(as.numeric(bedtime_WD), gender)`? I suspect `is.numeric(bedtime_WD)` returns `FALSE`. – Roland Dec 13 '22 at 08:16
  • I just ran it and it returned ```TRUE``` – ralphmacchio Dec 13 '22 at 08:22
  • are you using `dunn.test` from `rstatix`? If yes, then your second argument should be a formula and the frist argument a data.frame containing the referenced variables. You are providing two vectors – Julian_Hn Dec 13 '22 at 08:29
  • I'm not sure? I used ```library(dunn.test)``` to get the ```dunn.test()``` function – ralphmacchio Dec 13 '22 at 08:45
  • You should show us your data (or a subset of it if it's too big). Use `dput(bedtime_WD)` and `dput(gender)` so we can see them. One guess is that you have NA in your `bedtime_WD` variable, but it could be something else. The test that failed was `if (TRUE %in% is.na(unlist(x)) | !is.vector(unlist(x), mode = "numeric"))` (which is a pretty weird way to write such a test!). – user2554330 Dec 13 '22 at 09:30
  • You'll have a much easier time getting an answer if you provide a [minimal, reprodubile example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Captain Hat Dec 13 '22 at 09:42

0 Answers0