Re: [R] Months in alphabetical order rather than chronological order in graph

2011-01-28 Thread Don McKenzie
Kurt

You need to give us more information if you want good advice.  For example, 
what sort of plot are you trying to make?
A barplot?   A time series?

A reproducible example is always best.  Please see the R-news posting guide for 
hints on a successful query.



On Jan 28, 2011, at 1:53 PM, kurt_h...@nps.gov wrote:

 
 Greetings
 Though I have months in chronological order in my data table, the data
 were sampled every other month (i.e., February, April, June, August,
 October, December), every time I try to plot them (on the x-axis) they are
 plotted in alphabetical order.  What am I missing?
 Cheers
 Kurt
 
 ***
 Kurt Lewis Helf, Ph.D.
 Ecologist
 EEO Counselor
 National Park Service
 Cumberland Piedmont Network
 P.O. Box 8
 Mammoth Cave, KY 42259
 Ph: 270-758-2163
 Lab: 270-758-2151
 Fax: 270-758-2609
 
 Science, in constantly seeking real explanations, reveals the true majesty
 of our world in all its complexity.
 -Richard Dawkins
 
 The scientific tradition is distinguished from the pre-scientific tradition
 in having two layers.  Like the latter it passes on its theories but it
 also passes on a critical attitude towards them.  The theories are passed
 on not as dogmas but rather with the challenge to discuss them and improve
 upon them.
 -Karl Popper
 
 ...consider yourself a guest in the home of other creatures as significant
 as yourself.
 -Wayside at Wilderness Threshold in McKittrick Canyon, Guadalupe Mountains
 National Park, TX
 
 Cumberland Piedmont Network (CUPN) Homepage:
 http://tiny.cc/e7cdx
 
 CUPN Forest Pest Monitoring Website:
 http://bit.ly/9rhUZQ
 
 CUPN Cave Cricket Monitoring Website:
 http://tiny.cc/ntcql
 
 CUPN Cave Aquatic Biota Monitoring Website:
 http://tiny.cc/n2z1o
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




Don McKenzie
Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service

Affiliate Professor
School of Forest Resources and CSES Climate Impacts Group
University of Washington

phone: 206-732-7824
cell: 206-321-5966
d...@uw.edu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Months in alphabetical order rather than chronological order in graph

2011-01-28 Thread David Winsemius


On Jan 28, 2011, at 4:53 PM, kurt_h...@nps.gov wrote:


Greetings
Though I have months in chronological order in my data table,  
the data

were sampled every other month (i.e., February, April, June, August,
October, December), every time I try to plot them (on the x-axis)  
they are

plotted in alphabetical order.  What am I missing?


A reproducible example for one thing. A short sig for another.

 monfac - factor(month.name[sample(1:100)])
 plot(monfac)
 plot( factor(monfac, levels=month.name))



Cheers
Kurt

***
Kurt Lewis Helf, Ph.D.
Ecologist


--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Months in alphabetical order rather than chronological order in graph

2011-01-28 Thread RICHARD M. HEIBERGER
You need to make your variable into a factor and specify the order.

 mymonths - c(December, March)
 factor(mymonths)
[1] December March
Levels: December March
 factor(mymonths, levels=month.name)
[1] December March
12 Levels: January February March April May June July August September
October ... December
 month.name
 [1] January   February  March April May   June
July
 [8] AugustSeptember October   November  December
 month.abb
 [1] Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec


On Fri, Jan 28, 2011 at 4:53 PM, kurt_h...@nps.gov wrote:


 Greetings
 Though I have months in chronological order in my data table, the data
 were sampled every other month (i.e., February, April, June, August,
 October, December), every time I try to plot them (on the x-axis) they are
 plotted in alphabetical order.  What am I missing?
 Cheers
 Kurt

 ***
 Kurt Lewis Helf, Ph.D.
 Ecologist
 EEO Counselor
 National Park Service
 Cumberland Piedmont Network
 P.O. Box 8
 Mammoth Cave, KY 42259
 Ph: 270-758-2163
 Lab: 270-758-2151
 Fax: 270-758-2609

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Months in alphabetical order rather than chronological order in graph

2011-01-28 Thread Greg Snow
This would be easier if you showed us a sample of your data and what commands 
you are using.  Without we need to guess.

Probably your month variable is being turned into a factor somewhere and the 
default for factors is alphabetical.  The best solution depends on 
how/where/when your months are being factorized.  You need to control the 
factorizing, maybe turning them into some type of date object instead of a 
factor, or create the factor, but specify the order that you want.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of kurt_h...@nps.gov
 Sent: Friday, January 28, 2011 2:54 PM
 To: r-help@r-project.org
 Subject: [R] Months in alphabetical order rather than chronological
 order in graph
 
 
 Greetings
  Though I have months in chronological order in my data table, the
 data
 were sampled every other month (i.e., February, April, June, August,
 October, December), every time I try to plot them (on the x-axis) they
 are
 plotted in alphabetical order.  What am I missing?
 Cheers
 Kurt
 
 ***
 Kurt Lewis Helf, Ph.D.
 Ecologist
 EEO Counselor
 National Park Service
 Cumberland Piedmont Network
 P.O. Box 8
 Mammoth Cave, KY 42259
 Ph: 270-758-2163
 Lab: 270-758-2151
 Fax: 270-758-2609
 
 Science, in constantly seeking real explanations, reveals the true
 majesty
 of our world in all its complexity.
 -Richard Dawkins
 
 The scientific tradition is distinguished from the pre-scientific
 tradition
 in having two layers.  Like the latter it passes on its theories but it
 also passes on a critical attitude towards them.  The theories are
 passed
 on not as dogmas but rather with the challenge to discuss them and
 improve
 upon them.
 -Karl Popper
 
 ...consider yourself a guest in the home of other creatures as
 significant
 as yourself.
 -Wayside at Wilderness Threshold in McKittrick Canyon, Guadalupe
 Mountains
 National Park, TX
 
 Cumberland Piedmont Network (CUPN) Homepage:
 http://tiny.cc/e7cdx
 
 CUPN Forest Pest Monitoring Website:
 http://bit.ly/9rhUZQ
 
 CUPN Cave Cricket Monitoring Website:
 http://tiny.cc/ntcql
 
 CUPN Cave Aquatic Biota Monitoring Website:
 http://tiny.cc/n2z1o
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.