ANOVA analysis error

library(sjstats)
fit <- aov(Two-point field goals made ~ as.factor(month) + Assists, data = ZSL)
Error: unexpected symbol in "fit <- aov(Two-point field"

I have no idea why R always display this error?

Thanks all

Without your data, the actual issue can't be reproduced, but if "Two-point field goals made" is your variable name, you'll need to surround it in backticks `Two-point field goals made`, since it is not a "syntactically valid" name (see SO thread's below for detail):


Thanks Mara!!! I have solved my problem!!! I just start to learn R for one month!!! You know, I decide to learn R because almost everyday I look your twitter!!! Great honour to get your reply!!!

1 Like

Yay, glad to hear you've got it working right (and that the tweets are helpful :blush:).

If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.

Thanks