On Mon, Sep 26, 2011 at 1:45 PM, Philip Rhoades <p...@pricom.com.au> wrote:
> Gabor, Bill,
>
>
> On 2011-09-27 02:51, Gabor Grothendieck wrote:
>>
>> On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades <p...@pricom.com.au>
>> wrote:
>>>
>>> Gabor,
>>>
>>>
>>> On 2011-09-27 00:35, Gabor Grothendieck wrote:
>>>>
>>>> On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades <p...@pricom.com.au>
>>>> wrote:
>>>>>
>>>>> People,
>>>>>
>>>>> It appears that there is no way of getting Boxplots to plot using Mean,
>>>>> SD,
>>>>> Max & Min - is there something else that would do what I want?  I
>>>>> couldn't
>>>>> find it . .
>>>>>
>>>>
>>>> Try replacing the stats component of boxplot's output with your
>>>> desired statistics and then feeding that into the lower level bxp
>>>> function to do the graphics:
>>>>
>>>> bp <- boxplot(Nile, plot = FALSE)
>>>> bp$stats <- matrix(c(min(Nile), mean(Nile) + c(-1, 0, 1) * sd(Nile),
>>>> max(Nile)))
>>>> bxp(bp)
>>>
>>>
>>> Thanks for that!  What is the syntax when there is more than one set of
>>> data
>>> (ie a two dimensional vector)?  I tried messing around with stuff like:
>>>
>>>  mean(Nile[,2] etc
>>>
>>> but I get subscript out of range errors  . .
>>>
>>
>> Bill's example shows  how to do it with a list of numeric vectors.
>> Here is another example using the built in anscombe and making use of
>> my prior code, Bill's and Vining's:
>>
>> bp <- boxplot(anscombe, plot = FALSE)
>> bp$stats <- sapply(anscombe, function(x) c(min(x), mean(x) + c(-1, 0,
>> 1) * sd(x), max(x)))
>> bxp(bp, outline = FALSE)
>
>
> Interesting! - I've learnt something about anscombe and sapply and other
> stuff (thanks again!) but I think I mis-spoke before.  I think what I want
> is a list of numeric vectors but when I created tarr:
>
>  tarr <- array( dim = c( 5,3 ), c( 1,2,3,4,5,2,3,4,5,6,3,4,5,6,7 ) )
>
> I couldn't get it to work with the original code . . now I have had a closer
> look at Bill's code . .
>
> On the original question though, why isn't there something "off the shelf"
> that will do what I want?  Surely, a "boxplot" using mean, SD, max and min
> would be a common enough need to justify it?
>

tarr is not a list or a data frame. Use.data.frame(tarr) so that  it
uses the same assumptions as the examples in this thread.

I believe there is no such facility due to a philosophical opposition.
 Unless someone were careful they would naturally assume that boxplots
were shown even though that is not the case here.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.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.

Reply via email to