[R] binary scatterplot

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Feb 3 21:49:03 CET 2003


Michael Lynn Fugate wrote:
> 
> Hi,
> 
> When I use the function plot() to plot a categorical variable with two
> levels versus a continuous variable, the two levels of the categorical
> variable are plotted at the values of 1.0 and 2.0.  I would like them to
> be plotted at the values of 0.0 and 1.0.  How can I do this?
> 
> Example:
> 
> x <- 1:10
> y <- as.factor(rep(c("A","B"),c(5,5)))
> plot(x,y)


 plot(x, as.integer(y) - 1)

Uwe Ligges


> Thanks in advance.
> 
> version:
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    1
> minor    6.1
> year     2002
> month    11
> day      01
> language R
> 
> --
> 
> ******************************************************************
> | Michael Fugate                         Phone:  (505) 667-0398  |
> | Los Alamos National Laboratory         Fax:    (505) 665-5220  |
> | Group: CCS-3,  Mail Stop: B265         e-mail: fugate at lanl.gov |
> | Los Alamos, NM 87545                                           |
> ******************************************************************
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list