Hello, I am running a negative binomial model using the glm.nb function from the MASS package. When I run the model the following error appears:

Error in if (any(y < 0)) stop("negative values not allowed for the 'Poisson' family") :

missing value where TRUE/FALSE needed

In addition: Warning messages:

1: In model.response(mf, "numeric") :

using type = "numeric" with a factor response will be ignored

2: In Ops.factor(y, 0) : ‘<’ not meaningful for factors

My covariant of interest is numeric count data from 0-1900. I have converted this into numeric using the as.numeric function. My model looks like this:

model <- glm.nb(non_house_contact ~ wave, data = df)

I am not sure why this error is occurring. Any help would be appreciated. Thanks.