difficulties with lm function and NA error message

hi! im very new at r and im hoping someone might be able to offer some insight into this error message im getting? i did code two NA variables in my independent and dependent variable (as those respondents had replied "prefer not to answer") - i need to exclude those variables, so does anyone know how i might be able to get around this? thank you!

lm(jobsclimate ~ sovereignty, data = CES)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
In addition: Warning message:
In storage.mode(v) <- "double" : NAs introduced by coercion

Try

CES <- na.omit(CES)

before the regression.

Hm when I did that I got this error:

Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels

That most likely indicates a problem in your sovereignty data. You might want to use dput() to post CES here.

Where would I integrate that in my code?

CES <- na.omit(CES)
bivariate.model <- lm(jobsclimate ~ sovereignty, data = CES)
bivariate.model

Thanks for your help!

Sorry, I typed put() instead of dput.

Run your code and then you can do dput(CES) in the console. Then copy and paste here.