Douglas Bates-2 wrote:
On Wed, Sep 30, 2009 at 2:42 PM, Douglas Bates ba...@stat.wisc.edu
wrote:
And besides, Frank Harrell will soon be weighing in to tell you why
you shouldn't dichotomize in the first place.
Subjects in this study received a 20 ml infusion of Kirsch (40%, Swiss
Dear List,
creating factors in a given non-default orders is notoriously difficult to
explain in a course. Students love the ifelse construct given below most,
but I remember some comment from Martin Mächler (?) that ifelse should be
banned from courses.
Any better idea? Not necessarily short,
On Sep 30, 2009, at 3:43 AM, Dieter Menne wrote:
Dear List,
creating factors in a given non-default orders is notoriously
difficult to
explain in a course. Students love the ifelse construct given below
most,
but I remember some comment from Martin Mächler (?) that ifelse
should be
David Winsemius wrote:
# Typical C-Programmer style
factor(levs[as.integer(data 10)+1], levels=levs)
In your code the as.integer function is superfluous
Oops... done too much c# lately, getting invalid cast challenged.
Dieter
--
View this message in context:
1. A common way of doing this is cut:
cut(data, c(-Inf, 10, Inf), lab = levs, right = TRUE)
[1] Pre Pre Pre Post Post
Levels: Pre Post
We don't actually need right=TRUE as its the default but if you omit
it then it can be hard to remember whether the right end of intervals
are included
An extremely verbose, but (in my view) easy to understand approach is:
data.f - data; data.f[which(data = 10)] - levs[1]; data.f[which(data
10)] - levs[2]; data.f - factor(data.f)
-Ista
On Wed, Sep 30, 2009 at 8:31 AM, Dieter Menne
dieter.me...@menne-biomed.de wrote:
David Winsemius
On Wed, Sep 30, 2009 at 2:42 PM, Douglas Bates ba...@stat.wisc.edu wrote:
On Wed, Sep 30, 2009 at 2:43 AM, Dieter Menne
dieter.me...@menne-biomed.de wrote:
Dear List,
creating factors in a given non-default orders is notoriously difficult to
explain in a course. Students love the ifelse
On Wed, Sep 30, 2009 at 2:32 PM, Ista Zahn istaz...@gmail.com wrote:
An extremely verbose, but (in my view) easy to understand approach is:
data.f - data; data.f[which(data = 10)] - levs[1]; data.f[which(data
10)] - levs[2]; data.f - factor(data.f)
All those which()s are unnecessary. And
Douglas Bates wrote:
On Wed, Sep 30, 2009 at 2:42 PM, Douglas Bates ba...@stat.wisc.edu wrote:
On Wed, Sep 30, 2009 at 2:43 AM, Dieter Menne
dieter.me...@menne-biomed.de wrote:
Dear List,
creating factors in a given non-default orders is notoriously difficult to
explain in a course. Students
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Douglas Bates
Sent: Wednesday, September 30, 2009 12:42 PM
To: Dieter Menne
Cc: r-help@r-project.org
Subject: Re: [R] Condition to factor (easy to remember)
On Wed, Sep 30
10 matches
Mail list logo