0

I have the formula below:

ANOVAtest <- anova_test(data=Dataovershootwithoutmeans, formula=overshoot~Condition*Distancetodistalboundary+Error(ID/Condition*Distancetodistalboundary), dv=overshoot, wid=ID,within=c(Condition,Distancetodistalboundary),effect.size = "pes")

Error: Can't subset columns that don't exist. x The column Condition doesn't exist. Run rlang::last_error() to see where the error occurred.

Even though I can clearly see in my data frame that there is a column called 'Condition'!

Could anyone give a helping hand?

Reproducible data set:

library(rstatix)

ANOVAtest <- anova_test(data=Dataovershootwithoutmeans, formula=Stopdistancefromstart~Condition*Distancetodistalboundary+Error(ID/Condition*Distancetodistalboundary), dv=Stopdistancefromstart, wid=ID,within=c(Condition,Distancetodistalboundary),effect.size = "pes")

structure(list(Distancetodistalboundary = c(77.008, 77.008, 77.008, 
108.61, 108.61, 108.61, 156.016, 156.016, 156.016, 227.123, 227.123, 
333.784, 333.784, 77.008, 77.008, 77.008, 108.61, 108.61, 108.61, 
156.016), Condition = c("0", "0.5", "2", "0", "0.5", "2", "0", 
"0.5", "2", "0", "0.5", "0", "0.5", "0", "0.5", "2", "0", "0.5", 
"2", "0.5"), ID = c("P_200214123342", "P_200214123342", "P_200214123342", 
"P_200214123342", "P_200214123342", "P_200214123342", "P_200214123342", 
"P_200214123342", "P_200214123342", "P_200214123342", "P_200214123342", 
"P_200214123342", "P_200214123342", "P_200217101213", "P_200217101213", 
"P_200217101213", "P_200217101213", "P_200217101213", "P_200217101213", 
"P_200217101213"), Stopdistancefromstart = c(80.21, 98.661, 98.4568, 
114.916, 132.014666666667, 114.558, 175.139, 173.9455, 216.5585, 
245.408, 263.881, 360.428, 491.432, 81.4215, 83.917, 91.191, 
116.674, 158.305, 116.279, 176.845), overshoot = c(3.202, 21.653, 
21.4488, 6.306, 23.4046666666667, 5.94800000000001, 19.123, 17.9295, 
60.5425, 18.285, 36.758, 26.644, 157.648, 4.41350000000001, 6.90900000000001, 14.183, 8.06400000000001, 49.695, 7.669, 20.829)), row.names = c(NA, -20L), class = c("tbl_df", "tbl", "data.frame"))
Caledonian26
  • 727
  • 1
  • 10
  • 27
  • 2
    Please provide a fully reproducible example. – Phil Feb 29 '20 at 20:00
  • @Phil I have added one above :) – Caledonian26 Feb 29 '20 at 22:43
  • Hi Caledonian26. Please try to load the example data you posted. – dario Mar 01 '20 at 08:18
  • @dario the output of the above: A tibble: 20 x 5 Distancetodistal… Condition ID Stopdistancefro… overshoot 1 77.0 0 P_200… 80.2 3.20 2 77.0 0.5 P_200… 98.7 21.7 3 77.0 2 P_200… 98.5 21.4 – Caledonian26 Mar 01 '20 at 10:16
  • ? Please try to load the example data you posted. You will realize it doesn't run. Because you posted only a fraction of the ouptup from `dput`... I'd suggest reading [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and how to give a [minimale reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) before editing/commenting. – dario Mar 01 '20 at 10:19
  • @dario that was a mistake, there was a code above that which had the full data. We all make mistakes! I feel it's about learning! Please understand that I am undergraduate student wanting to achieve my best! – Caledonian26 Mar 01 '20 at 10:37
  • That's why I suggest you tried to load the code you posted in your question. Exactly **because** we all make mistakes we should be open and accepting of suggestions... – dario Mar 01 '20 at 10:46
  • Well, this `aov(Stopdistancefromstart~Condition*Distancetodistalboundary+Error(ID/Condition*Distancetodistalboundary), data = Dataovershootwithoutmeans)` works. Not sure if this is the hypothesis you wanted to test. But I don't see any reasons to use `anova_test` if you are not using pipes... – dario Mar 01 '20 at 11:00
  • @dario anova_test allowed me to check the sphericity assumption – Caledonian26 Mar 01 '20 at 11:01
  • I won't be able to help you with package specific problems since I've never used it. Just consider this: `The function is an easy to use wrapper around Anova() and aov()` [source](https://rpkgs.datanovia.com/rstatix/reference/anova_test.html). Best of luck! – dario Mar 01 '20 at 11:05

0 Answers0