Unexpected symbol message using the lm function in code

When I type the code:
mod1 <- lm(Funds Flow ~ TASS_ROR)

I get the error message:
"Error: unexpected symbol in "mod1 <- lm(Funds Flow"

I can't figure out if it is a problem with the data or my code.

1 Like

I think you should avoid space in variable name

As Peter_Griffin said, one issue is the space in the variable name. To make that work you need to surround the name by backticks, as in: `Funds Flow`. But it's better to use legal variable names in your data frame, like Funds_Flow. In addition, you also need to provide the data frame name to lm: lm(Funds_Flow ~ TASS_FOR, data=my_data).

A post was split to a new topic: How do you load a function into R?