Hi there. I am wondering if there is any argument or function in R that sets all variables equal to their means within the margins() command? I am trying to replicate the Stata code:
margins, at((mean) _all H_citytract_multi_i=(.23 .54))
Is there a way to do this besides manually setting all variables equal to their means in the R? E.g. something like:
marg_1 <- margins(m1, at = list(H_citytract_multi_i = c(.23, .54), diversityinterp = mean(rp$diversityinterp, na.rm = T), pctasianpopinterp = mean(rp$pctasianpopinterp, na.rm = T), pctblkpopinterp = mean(rp$pctblkpopinterp, na.rm = T), ... ))
This is very tedious with a large number of variables, and I was hoping to find something that dealt with factors/indicators like Stata does in this case.