Julia equivalent of the R function `model.matrix`


Is there a Julia function equivalent to the R function model.matrix? This R function returns the design matrix of a linear regression model. For example model.matrix(~ group + treatment + group:treatment, data = dat) returns the design matrix of the linear regression model with main effects group and treatment and with the interaction between group and treatment, looking in the dat dataframe to find these variables.

Yes. I believe it is called modelmatrix :wink:

It’s in the StatsModels.jl package


Ok, thanks. Will try soon.