How do I fix this? This is the code I wrote before. Do the number of observations have to be equal? Would appreciate any help!
DATA4=policeexcel2[,c("age", "gender", "raceethnicity", "month", "city","state", "latitude", "longitude", "tract_ce", "cause", "armed", "pop", "share_white", "share_hispanic", "share_black", "p_income", "h_income", "county_income", "comp_income")]
y1<-DATA4$share_white
x1<- model_matrix(DATA4, share_white~.*.)[,-1]
var.names1=names(x1)
dim(x1)
set.seed(216)
cvmod.0=cv.glmnet(y=y1,x=as.matrix(x1),alpha=0)
Error in glmnet(x, y, weights = weights, offset = offset, lambda = lambda, : number of observations in y (467) not equal to the number of rows of x (461)