harrelfe / Hmisc

Harrell Miscellaneous
Other
208 stars 81 forks source link

scale() removes "labelled" attribute #31

Open crsh opened 8 years ago

crsh commented 8 years ago

I really like the label() function. I have recently noticed that when I scale a variable this label attribute is lost. I haven't had time to go deeper into this, hence, I'm not sure if this problem is specific to scale() (and could be fixed by adding a scale.labelled-method) or needs a more general solution. I may take a closer look at some point, but I wanted to bring it to your attention in case I forget.

harrelfe commented 8 years ago

scale() changes the meaning of the variable so IMHO it would be inappropriate to keep the label. Frank

On 10/19/2015 05:33 AM, Frederik Aust wrote:

I really like the |label()| function. I have recently noticed that when I scale a variable this label attribute is lost. I haven't had time to go deeper into this, hence, I'm not sure if this problem is specific to |scale()| (and could be fixed by adding a |scale.labelled|-method) or needs a more general solution. I may take a closer look at some point, but I wanted to bring it to your attention in case I forget.

— Reply to this email directly or view it on GitHub https://github.com/harrelfe/Hmisc/issues/31.


Frank E Harrell Jr Professor and Chairman School of Medicine

Department of *Biostatistics*   *Vanderbilt University*
crsh commented 8 years ago

Thanks for the quick reply.

I agree it renders the "units" attribute useless, but doesn't, e.g., a scaled household income variable nonetheless represents household income?

harrelfe commented 8 years ago

Not in an exact sense, and some people put units of measurement inside the labels.

On 10/19/2015 09:30 AM, Frederik Aust wrote:

I agree it renders the "units" attribute useless, but doesn't, e.g., a scaled household income variable nonetheless represents household income?

— Reply to this email directly or view it on GitHub https://github.com/harrelfe/Hmisc/issues/31#issuecomment-149231899.


Frank E Harrell Jr Professor and Chairman School of Medicine

Department of *Biostatistics*   *Vanderbilt University*