From bbolker @ending from gm@il@com  Thu Dec 13 21:36:04 2018
From: bbolker @ending from gm@il@com (Ben Bolker)
Date: Thu, 13 Dec 2018 15:36:04 -0500
Subject: [Rd] Documentation examples for lm and glm
In-Reply-To: <b0027661-4c72-864d-7dea-a78ade7bf808@auckland.ac.nz>
References: <b0027661-4c72-864d-7dea-a78ade7bf808@auckland.ac.nz>
Message-ID: <3aee4716-f0d2-c683-0ad8-90ae6c5894ef@gmail.com>


  Agree.  Or just create the data frame with those variables in it
directly ...

On 2018-12-13 3:26 p.m., Thomas Yee wrote:
> Hello,
> 
> something that has been on my mind for a decade or two has
> been the examples for lm() and glm(). They encourage poor style
> because of mismanagement of data frames. Also, having the
> variables in a data frame means that predict()
> is more likely to work properly.
> 
> For lm(), the variables should be put into a data frame.
> As 2 vectors are assigned first in the general workspace they
> should be deleted afterwards.
> 
> For the glm(), the data frame d.AD is constructed but not used. Also,
> its 3 components were assigned first in the general workspace, so they
> float around dangerously afterwards like in the lm() example.
> 
> Rather than attached improved .Rd files here, they are put at
> www.stat.auckland.ac.nz/~yee/Rdfiles
> You are welcome to use them!
> 
> Best,
> 
> Thomas
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Documentation examples for lm and glm
Ben Bolker