On 07/25/2013 12:17 AM, BLASER Arnaud wrote:
Dear R mailing list readers,

I am facing the following problem; for simplicity imagine I am working on a 
data frame of, say, 5 columns. The first column is a list of European 
countries, the other four are an index (continuous variable) of climate change 
impact under 4 different scenarios.

...
However, when I try to use the code as above, R automatically re-order the x-axis 
(country) in alphabetical order. This was not unexpected, but I have spent the day 
(unsuccessfully) looking for a way to simply tell R not to do that and to keep the 
variable "country" as it is now ordered in the data frame to construct the 
x-axis of my plot. Is there any way to force it to keep the order as it is in the data 
frame ?

Hi Arnaud,
If you want a non-alphabetic ordering of factors, you will have to explicitly specify the order:

country<-factor(
c("Austria","Belgium","Bulgaria","Czech Republic","United Kingdom"),
levels=c("Austria","Belgium","United Kingdom","Bulgaria",
"Czech Republic"))

Jim

______________________________________________
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.

Reply via email to