Hi! I'm new to R studio and having a problem with my lm function.
I created a new variable in my dataframe:
df <- df %>% mutate(logweekpay=log(df$weekpay))
But when I try regressing it onto the female variable with:
lm(df$logweekpay~df$female)
I get: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf dans 'y'
I tried regressing df$weekpay on df$female and it worked just fine. Can sombdy help me figure out the problem?
typeof(df$female)
[1] "integer"
typeof(df$weekpay)
[1] "double"
typeof(df$logweekpay)
[1] "double"