We are often asked about how to calculate marginal effects in R, especially from Stata users who use Stata's
marginsplot commands after regression models. These two packages in R have similar functions to Stata's margins and marginsplot commands, which are used to calculate marginal effects after a regression model and graph them:
These packages are easy to use and have most of the functionalities we are looking for. However, they are not as powerful as Stata's
marginsplot commands, in the sense R's commands are mostly for linear models, while Stata has implemented it for almost all regression commands.