Unexpected symbol message using the lm function in code


#1

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.


#2

I think you should avoid space in variable name


#3

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).


#4

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