[R] binary scatterplot

John Fox jfox at mcmaster.ca
Mon Feb 3 21:56:08 CET 2003


Dear Michael,

You could use plot(x, as.numeric(y) - 1).

John

At 01:10 PM 2/3/2003 -0700, 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)

____________________________
John Fox
Department of Sociology
McMaster University
email: jfox at mcmaster.ca
web: http://www.socsci.mcmaster.ca/jfox




More information about the R-help mailing list