0

I am trying to do a regression using glm but it is coming with an unexpected error Here is the code:

mod1 <- glm(N_agreements ~ Population + PublicStaff + Macrorregion + Direct Plan, data = ILC, family = binomial)
summary(mod1)

the message:

Error: unexpected symbol in "mod1 <- glm(Education ~ Population + PublicStaff + Macrorregion + Direct Plan"
MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 1
    Use ```mod1 <- glm(N_agreements ~ Population + PublicStaff + Macrorregion + `Direct Plan`, data = ILC, family = binomial)``` You need backticks around column names with spaces. It's usually better not to have column names with spaces. – MrFlick Aug 16 '20 at 04:20
  • On @MrFlick's note, when I have data that really *needs* to have a space in the column in some report, I change the name to include the space *just before rendering* the report. This is a form of "just-in-time" data naming/formatting. – r2evans Aug 16 '20 at 04:40

0 Answers0