[R] dot diagram

Greg Snow Greg.Snow at intermountainmail.org
Mon Apr 10 18:53:03 CEST 2006


A basic implementation of this is the "dots" function in the
TeachingDemos package.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jinsong Zhao
> Sent: Sunday, April 09, 2006 12:07 AM
> To: R-help
> Subject: [R] dot diagram
> 
> Hi,
> 
> I am wondering whether there is a function that could plot a 
> dot diagram like the output of following code.
> 
> Thanks in advance!
> 
> Best wishes!
> 
> Jinsong
> 
> 
> --------->my dirty code here<---------
> 
> mydata <- c(26,26,27,27,27,27,28,28,28,28,28,28,28,28,28,
> 	    28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,
> 		30,30,30,30,30,30,30,30,31,31,31,31,32,33,33,
> 		33,34,34,35,43)
> 
> my.dot.plot <- function(x, ...) {
>     x.table <- table(x)
>     x.x <- as.numeric(names(x.table))
>     x.y <- as.numeric(x.table)
>     n <- length(x.x)
>     x.final <- NULL
>     for (i in 1:n) {
>         tmp <- data.frame(x=rep(x.x[i], x.y[i]), y=1:x.y[i])
>         x.final <- rbind(x.final, tmp)
>     }
>     plot(x.final, yaxt="n", ylab="", pch=19, frame.plot=FALSE, ...) }
> 
> my.dot.plot(mydata, xlab ="speed", xlim=c(25,45))
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list