Re: [R] Plotting pairs of bars

2009-05-06 Thread Jim Lemon

Steve Murray wrote:

Jim and all,

Thanks for the suggestion, however, I get the following error:

  

barplot(t(combine86[,1:2], beside = TRUE, las = 1))

Error in t(combine86[, 1:2], beside = TRUE, las = 1) : 
  unused argument(s) (beside = TRUE, las = 1)


I've looked up ?t and cannot see any extra arguments that I should be 
including, and the executes without the 't'.

What is it that I've omitted that I need to successfully execute the code (as 
previously described)?

  

)

after the right square bracket, and remove the last right parenthesis.

Jim

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


Re: [R] Plotting pairs of bars

2009-05-06 Thread Ben Bolker



Steve Murray-3 wrote:
> 
> 
> Jim and all,
> 
> Thanks for the suggestion, however, I get the following error:
> 
>> barplot(t(combine86[,1:2], beside = TRUE, las = 1))
> Error in t(combine86[, 1:2], beside = TRUE, las = 1) : 
>   unused argument(s) (beside = TRUE, las = 1)
> 
> I've looked up ?t and cannot see any extra arguments that I should be
> including, and the executes without the 't'.
> 
> What is it that I've omitted that I need to successfully execute the code
> (as previously described)?
> 

Just misplaced parentheses:

barplot(t(combine86[,1:2]),beside=TRUE,las=1)

-- 
View this message in context: 
http://www.nabble.com/Plotting-pairs-of-bars-tp23390374p23405072.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Plotting pairs of bars

2009-05-06 Thread Steve Murray

Jim and all,

Thanks for the suggestion, however, I get the following error:

> barplot(t(combine86[,1:2], beside = TRUE, las = 1))
Error in t(combine86[, 1:2], beside = TRUE, las = 1) : 
  unused argument(s) (beside = TRUE, las = 1)

I've looked up ?t and cannot see any extra arguments that I should be 
including, and the executes without the 't'.

What is it that I've omitted that I need to successfully execute the code (as 
previously described)?

Many thanks again,

Steve


_
[[elided Hotmail spam]]

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


Re: [R] Plotting pairs of bars

2009-05-06 Thread Jim Lemon

Steve Murray wrote:

Thanks for the reply - the 'beside' argument certainly looks useful, although 
I'm still not getting the output I'd hoped for.

By doing: barplot(combine86[,1:2], beside = TRUE, las = 1, 
xlab=rownames(combine86))
...I get all the bars for the 'Sim Mean' column plotted on the left side of the 
graphics device and all the bars for the 'Obs Mean' clustered on the right side.

Ideally I'd like bar 1 to be from 'Sim Mean' for Amazon and then bar 2 for 'Obs 
Mean' for Amazon. Then there would be a small gap separating the Amazon from 
the next pair of bars of the next river (Nile). Then it would be the 'Sim Mean' 
value for Nile, followed by the 'Obs Mean' value for Nile, then a gap, then 
onto the next river and so on.
  

Hi Steve,
Try transposing:

barplot(t(combine86[,1:2]),...)

Jim

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


Re: [R] Plotting pairs of bars

2009-05-06 Thread Steve Murray

Thanks for the reply - the 'beside' argument certainly looks useful, although 
I'm still not getting the output I'd hoped for.

By doing: barplot(combine86[,1:2], beside = TRUE, las = 1, 
xlab=rownames(combine86))
...I get all the bars for the 'Sim Mean' column plotted on the left side of the 
graphics device and all the bars for the 'Obs Mean' clustered on the right side.

Ideally I'd like bar 1 to be from 'Sim Mean' for Amazon and then bar 2 for 'Obs 
Mean' for Amazon. Then there would be a small gap separating the Amazon from 
the next pair of bars of the next river (Nile). Then it would be the 'Sim Mean' 
value for Nile, followed by the 'Obs Mean' value for Nile, then a gap, then 
onto the next river and so on.

Thanks for any help,

Steve


_
[[elided Hotmail spam]]

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


Re: [R] Plotting pairs of bars

2009-05-05 Thread Greg Snow
Look at the beside argument to the barplot function.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Steve Murray
> Sent: Tuesday, May 05, 2009 9:52 AM
> To: r-help@r-project.org
> Subject: [R] Plotting pairs of bars
> 
> 
> Dear all,
> 
> I have a matrix called combine86 which looks as follows:
> 
> > combine86
>  Sim Mean   Obs Mean  Sim Sum Obs Sum
> AMAZON  1172.0424  1394.44604  553204  659573
> NILE 262.4440   164.23921   67973   41881
> CONGO682.8007   722.63971  205523  214624
> MISSISSIPPI  363.0758   142.59883  124535   49054
> AMUR 143.585789.30434   36040   22594
> PARANA   702.3793   388.03030  162952   89635
> YENISEI  208.1396   174.52722   83464   70509
> OB   197.0399   162.82697   79013   63991
> LENA 118.110077.49638   48307   32161
> NIGER374.8258   212.25714   66719   37145
> ZAMBEZI  500.   485.87610   57000   54904
> YANGTZE  358.4172   256.80246   58422   41602
> 
> 
> For each of the rivers (which are the row names of this matrix), I wish
> to plot a bar for Simulated Mean and another for the Observed Mean. So
> far I've only been able to get R to stack the bars (using 'barplot) on
> top of one another, which isn't really what I want! I was hoping more
> for a pairing of bars (one 'Sim' and one 'Mean') followed by a gap,
> then the next pair of bars for the next river, a gap, and so on. Is
> this possible to do in R? If so, how?!
> 
> Many thanks,
> 
> Steve
> 
> 
> _
> [[elided Hotmail spam]]
> 
> __
> 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.

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