Re: [R] Barplot help

From: stephen sefick <ssefick_at_gmail.com>
Date: Wed, 11 Jun 2008 14:02:17 -0400

I had to to get the data as a matrix and fix a couple of other things- If you would like for me to post my solution then I can. I appoligize my fingers went faster than my brain.

Stephen

On Wed, Jun 11, 2008 at 1:55 PM, Marc Schwartz <marc_schwartz_at_comcast.net> wrote:

> 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
>
>

-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_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.
Received on Wed 11 Jun 2008 - 20:10:26 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 11 Jun 2008 - 21:31:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive