formulaic
formulaic copied to clipboard
Allow `Term` instances to control the naming of output columns in model matrices
This allows Term
subclasses to label model matrix columns differently based on context; e.g. if a column is a random effect column, then it might be labelled as: a|g
rather than a:g
.
I want to request a similar feature for categorical variables.
Currently they get formatted as C({parameter})[T.{value}]
.
E.g.,
BinGrp = [0, 0, 0, 1, 1, 1]
becomes
C(BinGrp)[T.0] C(BinGrp)[T.1]
0 1 0
1 1 0
2 1 0
3 0 1
4 0 1
5 0 1
It would be nice if we could pass in a format string to get simplier names. E.g. BinGrp0, BinGrp1 if we pass in a format string like "{parameter}{value}"
Hi @hguturu ! Thanks for reaching out! Let's move that to a separate issue, since this is requesting custom formatting via the formula expression itself, as compared to via the API as here. I'll let you do that and then continue the discussion there!