Hi there. I am new to here. I hope I am asking my question right.
I am running a mixed ANOVA test. The data set look like this (between-subject: Version, within-subject: Session):
> US_mem_forAV
A tibble: 206 x 4
Groups: Subj [103]
Subj Session mean(US.Identity) version
<chr> <chr> <dbl> <chr>
1 new108 A 0.0833 sleep
2 new108 B 0.0833 sleep
3 new113 A 0.417 sleep
4 new113 B 0.25 sleep
5 new117 A 0.25 sleep
6 new117 B 0.167 sleep
7 new118 A 0.833 sleep
8 new118 B 0.75 sleep
9 new122 A 1 sleep
10 new122 B 1 sleep
For version, there is another group called "wake" which is not shown here. (mean(US.Identity) is the column name)
I used the "rstatix" package and ran this:
> res.aov <- anova_test(
data = US_mem_forAV, dv = US_mem_forAV$`mean(US.Identity)`, wid = US_mem_forAV$Subj,
between = US_mem_forAV$version, within = US_mem_forAV$Session)
And the error message was shown:
>Error: Must subset columns with a valid subscript vector.
x Can't convert from <double> to <integer> due to loss of precision.
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
x
+-<error/vctrs_error_subscript_type>
| Must subset columns with a valid subscript vector.
| x Can't convert from double to integer due to loss of precision.
\-<error/vctrs_error_cast_lossy>
Can't convert from double to integer due to loss of precision.
>Backtrace:
1. rstatix::anova_test(...)
51. vctrs:::vec_cast.integer.double(...)
52. vctrs::maybe_lossy_cast(out, x, to, lossy, x_arg = x_arg, to_arg = to_arg)
56. vctrs:::stop_lossy_cast(...)
57. vctrs:::stop_vctrs(...)
I tried another command:
> res.aov <- anova_test(
data = US_mem_forAV, "mean(US.Identity)", wid = Subj,
between = version, within = Session)
and another error message showed up:
>Error: Problem with `mutate()` input `data`.
x $ operator is invalid for atomic vectors
i Input `data` is `map(.data$data, .f, ...)`.
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/dplyr_error>
Problem with `mutate()` input `data`.
x $ operator is invalid for atomic vectors
i Input `data` is `map(.data$data, .f, ...)`
Backtrace:
1. rstatix::anova_test(...)
10. rstatix::doo(...)
3. dplyr::ungroup(.)
3. dplyr::mutate(., data = map(.data$data, droplevels))
11. dplyr::mutate(., data = map(.data$data, .f, ...))
21. dplyr:::mutate_cols(.data, ...)
May I know what is happening and how do I fix this?
Thank you.