Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread Bert Gunter
, levels = 8:1) >>> str(coloursf2) >>> >>> Duncan >>> >>> Duncan >>> Duncan Mackay >>> Department of Agronomy and Soil Science >>> University of New England >>> Armidale NSW 2351 >>> Email: home: mac...@northnet.com

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread David Winsemius
Science >> University of New England >> Armidale NSW 2351 >> Email: home: mac...@northnet.com.au >> >> >> ordered used in >> used in MASS::polr and GEE for polytomous logistic regression >> >> -Original Message- >> From: r-help-

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread S Ellison
> There are two reasons. First is that in the "day_of_week", the starting day is > Friday so if you plot a graph, the left most column will start with Friday. > You > may like to start the column with Monday. Plotting levels in a particular order by default does not usually require an ordered f

[R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread Alok Shende
Hi, There are two reasons. First is that in the "day_of_week", the starting day is Friday so if you plot a graph, the left most column will start with Friday. You may like to start the column with Monday. The second reason is that instead of having all these long factor names (Monday,...), the cod

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Bill
au > > > ordered used in > used in MASS::polr and GEE for polytomous logistic regression > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On > Behalf Of Bill > Sent: Monday, 2 December 2013 21:24 > To: r-help@r-

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Duncan Mackay
r polytomous logistic regression -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bill Sent: Monday, 2 December 2013 21:24 To: r-help@r-project.org Subject: [R] why change days of the week from a factor to an ordered factor? I am readin

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Bill
Thanks to all, still a bit of a mystery. It is for the graphing I guess but not sure why. I don't think there is too much sense to saying that Tuesday precedes Wednesday but there could, as some of you suggest, be circumstances where this is useful. On Mon, Dec 2, 2013 at 12:00 PM, Bert Gunter w

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Bert Gunter
Did you not see Mark Leeds's post? The OP apparently did not really mean R's "ordered factors" as produced by the R ordered() constructor; rather, he meant "factors with levels ordered differently than the default", for which Rich's answer was apropos. Mine -- and now yours -- in which we wrongly

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Robert Baer
On 12/2/2013 9:35 AM, Bert Gunter wrote: > Not true, Rich. The point about alphabetical ordering explains why the author likely explicitly set the levels for the factor, though. As to why ordered factors, we may never know, but one possible explanation is that at some point he was going to use

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Richard M. Heiberger
Bert, the issue is the sort order of the levels. Time series graphs in the alphabetical sort order will be uninterpretable. I show the three sets of contrasts for factors, factors with specified levels, and ordered factors. week <- c("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread peter dalgaard
On 02 Dec 2013, at 16:35 , Bert Gunter wrote: > Not true, Rich. > >> z <-factor(letters[1:3],lev=letters[3:1]) >> sort(z) > [1] c b a > Levels: c b a > > What you say is true only for the **default** sort order. > > (Although maybe the code author didn't realize this either) The coding is ce

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Bert Gunter
Not true, Rich. > z <-factor(letters[1:3],lev=letters[3:1]) > sort(z) [1] c b a Levels: c b a What you say is true only for the **default** sort order. (Although maybe the code author didn't realize this either) -- Bert On Mon, Dec 2, 2013 at 7:24 AM, Richard M. Heiberger wrote: > If days of

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Richard M. Heiberger
If days of the week is not an Ordered Factor, then it will be sorted alphabetically. Fr Mo Sa Su Th Tu We Rich On Mon, Dec 2, 2013 at 6:24 AM, Bill wrote: > I am reading the code below. It acts on a csv file called dodgers.csv with > the following variables. > > >> print(str(dodgers)) # check t

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Bert Gunter
"BIll" : (Sorry -- Doubt that this will be helpful, but I couln't resist) "I don't understand why the author of the code decided to make the factor days_of_week into an ordered factor. Anyone know why this should be done?" A definitive answer would require either psychic abilities or asking the

[R] why change days of the week from a factor to an ordered factor?

2013-12-02 Thread Bill
I am reading the code below. It acts on a csv file called dodgers.csv with the following variables. > print(str(dodgers)) # check the structure of the data frame 'data.frame': 81 obs. of 12 variables: $ month : Factor w/ 7 levels "APR","AUG","JUL",..: 1 1 1 1 1 1 1 1 1 1 ... $ day