[R-sig-eco] plotting numeric v. factor variables

Kingsford Jones kingsfordjones at gmail.com
Sat Jun 6 01:45:32 CEST 2009


Hi Bessie,

library(lattice)
x <- rep(1:3, each=20)
y <- rnorm(60, x)
x <- c('level1', 'level2', 'level3')[x]
stripplot(y ~ x)

# or perhaps

stripplot(x ~ y, jitter=TRUE)



Kingsford Jones


On Fri, Jun 5, 2009 at 5:02 PM, bessie green<bessie.bug at gmail.com> wrote:
> Hi.  This seems like it should be really obvious but I haven't been able to
> find a way to do it.
>
> I want to plot some data so that i have 3 levels of a factor variable on the
> x-axis, and then numeric values for the response variable on the y-axis.
>  This would be a plot that is similar to a boxplot with the data points
> showing on it, except without the box and whiskers.  Is there a plotting
> function in R to do this?
>
> thanks,
> bessie
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Bessie Green Markley
> M.S. Candidate, Dept. of Biology and Wildlife
> Alaska Cooperative Fish and Wildlife Research Unit
> Institute of Arctic Biology
> Sheenjek trailer, N. Koyukuk Drive
> University of Alaska Fairbanks 99775
> 907-474-1949
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



More information about the R-sig-ecology mailing list