Skip to content
Back to formatted view

Raw Message

Message-ID: <20041110112813.GA4165@s1x.local>
Date: 2004-11-10T11:28:13Z
From: wolfram at fischer-zim.ch
Subject: lattice: ordering the entries in a dotplot of a vector

I tried:
    n <- 9
    x <- sample(n)
    names(x) <- LETTERS[1:n]
    dotplot( sort(x) )

The lines of the dotplot are not ordered according to the values of x
(but according to the names of x).

So I did:

    dfx <- data.frame( x=x, label=factor( names(x), names(x)[order(x)] ) )
    dotplot( label ~ x, data=dfx )

So I got what I wanted.

My question: Is there an easier solution for doing that?

Wolfram