R: How to plot a vector, grouped by a factor
Posted
by amarillion
on Stack Overflow
See other posts from Stack Overflow
or by amarillion
Published on 2010-04-02T17:50:19Z
Indexed on
2010/04/02
17:53 UTC
Read the original article
Hit count: 351
In R, given a vector
casp6 <- c(0.9478638, 0.7477657, 0.9742675, 0.9008372, 0.4873001, 0.5097587, 0.6476510, 0.4552577, 0.5578296, 0.5728478, 0.1927945, 0.2624068, 0.2732615)
and a factor:
trans.factor <- factor (rep (c("t0", "t12", "t24", "t72"), c(4,3,3,3)))
I want to create a plot where the data points are grouped as defined by the factor. So the categories should be on the x-axis, values in the same category should have the same x coordinate.
Simply doing plot(trans.factor, casp6)
does almost what I want, it produces a boxplot, but I want to see the individual data points.
© Stack Overflow or respective owner