Displaying 1 result from an estimated 1 matches for "olttru".
Did you mean:
olttrue
2007 Nov 15
1
Why is model.matrix creating 2 columns for boolean?
...have a data frame "reading" that includes a logical variable "OLT"
along with response variable "Reading" and predictor "True" (BOTH are
numeric variables; it's "True" as in the true value).
When I suppress the intercept, model.matrix gives me OLTTRUE and
OLTFALSE columns. Why? Can I do anything to prevent it?
> r <- model.matrix(Reading~0+OLT, reading)
> r[1:5,]
OLTFALSE OLTTRUE
1 1 0
2 1 0
3 1 0
4 1 0
5 1 0
> reading$OLT[1:2]
[1] FALSE FALSE
> r <- model.m...