rstatix icon indicating copy to clipboard operation
rstatix copied to clipboard

(Wrong) warning messages when using group_by with anova_test

Open cbsteh opened this issue 3 years ago • 1 comments

library(tidyverse)
library(rstatix)

df <- tribble(
  ~id, ~time, ~rpm, ~ratio, ~val,
  1,   0,     50,   1,      6.49,
  2,   0,     50,   1,      6.51,
  3,   0,     80,   1,      6.49,
  4,   0,     80,   1,      6.49,
  5,   0,     50,   3,      6.56,
  6,   0,     50,   3,      6.56,
  7,   0,     80,   3,      6.50,
  8,   0,     80,   3,      6.44,
  9,   0,     50,   6,      6.52,
  10 , 0,     50,   6,      6.59,
  11,  0,     80,   6,      6.65,
  12,  0,     80,   6,      6.60,
  1,   3,     50,   1,      4.61,
  2,   3,     50,   1,      4.80,
  3,   3,     80,   1,      4.33,
  4,   3,     80,   1,      4.36,
  5,   3,     50,   3,      4.81,
  6,   3,     50,   3,      4.70,
  7,   3,     80,   3,      4.80,
  8,   3,     80,   3,      4.82,
  9,   3,     50,   6,      4.60,
  10 , 3,     50,   6,      4.63,
  11,  3,     80,   6,      4.74,
  12,  3,     80,   6,      4.72
)

df <-df %>% mutate(across(id:ratio, as.factor))

twoway_1 <- df %>%
  group_by(time) %>%
  anova_test(dv = val, wid = id, between = c(rpm, ratio))  # OK
twoway_1

twoway_2 <- df %>%
  group_by(rpm) %>%
  anova_test(dv = val, wid = id, between = c(time, ratio)) # Warning messages
twoway_2

The warning messages I get are:

Warning: Problem with `mutate()` column `data`.
i `data = map(.data$data, .f, ...)`.
i The 'wid' column contains duplicate ids across between-subjects variables. Automatic unique id will be created.

I do not believe the error is in my data entry as I have used in verbatim other external data and they all give the same warning messages.

cbsteh avatar Aug 16 '21 04:08 cbsteh

Have you find a solution? I have just exactly the same error:

Error: Problem with `mutate()` column `data`.
i `data = map(.data$data, .f, ...)`.
x 0 (non-NA) cases

MonicaCalSan avatar Mar 17 '22 21:03 MonicaCalSan