From @purd|e@@ @end|ng |rom gm@||@com  Sun Sep  1 04:59:59 2019
From: @purd|e@@ @end|ng |rom gm@||@com (Abby Spurdle)
Date: Sun, 1 Sep 2019 14:59:59 +1200
Subject: [Rd] inconsistent handling of factor, character,
 and logical predictors in lm()
In-Reply-To: <6E6A225D-E514-4980-A454-1BD2D77FC04B@mcmaster.ca>
References: <ACD1644AA6C67E4FBD0C350625508EC836CF0E5B@FHSDB2D11-2.csu.mcmaster.ca>
 <CAB8pepxHcs6gzhkCQsHZh1ZUmPSXPQyTkYs=K+fmK=M1Zicr3Q@mail.gmail.com>
 <6E6A225D-E514-4980-A454-1BD2D77FC04B@mcmaster.ca>
Message-ID: <CAB8pepwM9fAuQB2S_ZkB3RBCkGLa2Ej1G8qsAO7u6hg5DgkfHQ@mail.gmail.com>

> I think that this misses the point I was trying to make: lm() et al. treat logical variables as factors, not as numerical predictors.

I'm unenthusiastic about mapping TRUE to -1 and FALSE to 1, in the model matrix.
(I nearly got that back the front).

However, I've decided to agree with your original suggestion,
regarding $xlevels.
I think it should include the logical levels, if that's the right term...

However, I note that the output still won't be completely consistent.
Because one case leads to a logical vector and the other cases lead to
character vectors.



[Rd] inconsistent handling of factor, character, and logical predictors in lm()
Abby Spurdle