Anson NG
Anson NG

Reputation: 103

Error regarding the use of lm() function (in R)

I am still new to R and not very familiar with how the code works there. I want to do OLS regression but I don't understand why the following code does not work. Can someone tell me what I have done wrong please?

wage <- read.csv("wage21.csv")
earnings <- wage$EARNINGS    
S <- wage$S    
model1 <- lm(earnings  ̃ 1+S) 

It responds with an error of

Error in parse(text = x, srcfile = src): <text>:6:24: unexpected input
5: 
6: model1 <- lm(earnings  <cc>
                          ^
Traceback:

Upvotes: 0

Views: 146

Answers (1)

hello_friend
hello_friend

Reputation: 5798

fit1 <- lm(EARNINGS ~ 1+S, data = wage) 

Upvotes: 1

Related Questions