[R] ordering in dotplot

Luca De Benedictis debene at unimc.it
Mon Feb 2 10:51:30 CET 2004


Dear R-friends,

the dataset I am using (data.it) is organized as follows

partner    stp    btp    reg
hk    0.64    1    s
ger    0.27    1    d
tur    0.27    1    s
rom    0.24    1    s-f
por    0.24    1    s
spa    0.23    1    s
gre    0.22    1    d-f
aus    0.17    1    d
uk    0.16    1    s
be    0.16    1    d
arg    0.15    1    s
usa    0.13    1    d-f
fra    0.13    1    s
neth    0.05    1    s-f
pol    0.05    1    d
bra    0.04    1    s
ko    0.006    1    s
un    -0.009    2    d-f
svi    -0.022    2    s-f
cin    -0.040    2   d
ru    -0.074    2    d-f
mex    -0.077    2    s
...    ...    ...    ...

and plotting it using dotplot, I specified the script as:

library(lattice)
attach(data.ita)
dotplot(reg~stp | partner, data=data.ita, groups=btp,
            xlab=list("Data - 
it",cex=1.5),col=c("black","red"),aspect=0.3,as.table=TRUE,xlim=c(-1,1))
detach(data.ita)

In the resulting plot the variable "reg" is ordered alphabetically. 
Instead, I would like the variable to be plotted in the following order: 
"s", "s-f", "d", "d-f".
How can I do it?

Many thanks
Luca




More information about the R-help mailing list