#adding packages and features
install.packages('MatchIt')
library(MatchIt)
ldata <- MatchIt::lalonde
ldata$hispan <- ifelse(ldata$race=='hispan',1,0)
ldata$white <- ifelse(ldata$race='white',1,0)
#model to find propensity scores
propscores <- fitted.values(glm(treat~age+educ+white+hispan+married+nodegree+re74+re75,
family=binomial, data=ldata))
#Returns error:
Error in `function (object, ...) \nobject`(list(treat = c(1L, 1L, 1L, :
could not find function "function (object, ...) \nobject"
Code worked on my professor's code, but not on mine. I'm not sure why? I've tried library(glmnet) in case it's to do with the glm() function not being recognised.