on 06/11/2008 12:44 PM stephen sefick wrote:
#I am having trouble figuring out this one.  I have read the help and I am
at a loss.  what am I missing

x <- structure(list(X = structure(c(6L, 5L, 9L, 2L, 10L, 8L, 7L, 3L,
13L, 12L, 11L, 4L, 1L, 1L, 1L), .Label = c("", "April", "August",
"December", "February", "January", "July", "June", "March", "May",
"November", "October", "September"), class = "factor"), X2006 = c(5987.387,
6478.592, 8386, 4651.273, 4339.167, 4631.978, 5217.306, 5846.903,
3867.825, 3886.434, 3959.668, 3848.853, NA, NA, NA), X2007 = c(4354.516,
5924.315, 5559.468, 3967.5, 5053.56, 4808.694, 4017.632, 3969.883,
3910.236, 3782.094, 3961.286, 3711.262, NA, NA, NA), X2008 = c(3685.789,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("X",
"X2006", "X2007", "X2008"), class = "data.frame", row.names = c(NA,
-15L))

barplot(x)

#I would like the months to be on the x-axis and then have the bars be the
values for the year

Is this what you want?

  barplot(t(x[-1]), names.arg = x$X, las = 2)

Note that the 'height' argument for barplot() needs to be either a vector or a matrix.

HTH,

Marc Schwartz

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to