using reorder in dotplot

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

using reorder in dotplot

Veerappa Chetty
Hi,
Please help to correct my error in the following. I want to plot the values
of 'x" in increasing order.
-----------------------------------
library(lattice)
Name<-c("A","B","C")
x<-c(15,20,10)
test<-data.frame(Name,x)
dotplot(Name~x,test)
dotplot(reorder(Name,x)~x,test)

"reorder" has no effect!
Thanks.
Chetty
------------------------

--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: [hidden email],[hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: using reorder in dotplot

David Winsemius

On Mar 22, 2010, at 9:51 PM, Veerappa Chetty wrote:

> Hi,
> Please help to correct my error in the following. I want to plot the  
> values
> of 'x" in increasing order.
> -----------------------------------
> library(lattice)
> Name<-c("A","B","C")
> x<-c(15,20,10)
> test<-data.frame(Name,x)
> dotplot(Name~x,test)
> dotplot(reorder(Name,x)~x,test)
>
> "reorder" has no effect!

Are you sure? It appears to do so on my machine.

 > sessionInfo()
R version 2.10.1 RC (2009-12-09 r50695)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Matrix_0.999375-32 lattice_0.17-26

loaded via a namespace (and not attached):
[1] grid_2.10.1  tools_2.10.1

--
David.

> Thanks.
> Chetty
> ------------------------
>
> --
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: [hidden email],[hidden email]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: using reorder in dotplot

Deepayan Sarkar
In reply to this post by Veerappa Chetty
On Tue, Mar 23, 2010 at 7:21 AM, Veerappa Chetty <[hidden email]> wrote:

> Hi,
> Please help to correct my error in the following. I want to plot the values
> of 'x" in increasing order.
> -----------------------------------
> library(lattice)
> Name<-c("A","B","C")
> x<-c(15,20,10)
> test<-data.frame(Name,x)
> dotplot(Name~x,test)
> dotplot(reorder(Name,x)~x,test)
>
> "reorder" has no effect!

It has for me:

> Name
[1] "A" "B" "C"
> reorder(Name,x)
[1] A B C
attr(,"scores")
 A  B  C
15 20 10
Levels: C A B

Are you using a recent enough R?

-Deepayan

______________________________________________
[hidden email] 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.