I am attempting to run a multi-level regression and poststratification in R, and I keep getting an error that my dependent variable "must be integer values of 0 / 1 or logical". I ran the following
punitive.data <- within(punitive.data, punall <- as.integer(punall))
followed by
is.integer(punitive.data$punall)
which returned a response of TRUE
.
Then I ran
mrp.simple <- mrp(punall ~ statenum + f.race , data = punitive.data, population = census.data)
which returned the following error:
Error in checkResponse(response, response.varname) :
'punall' must be integer values of 0 / 1 or logical.
I rechecked the variable type with the is.integer
function and got a TRUE
response again. The variable also shows as an integer in the Environment. All values in the variable are either 0 or 1.
Any advice or help would be greatly appreciate.