[R] monthly boxplot

David Winsemius dwinsemius at comcast.net
Tue Aug 9 17:32:41 CEST 2011


On Aug 9, 2011, at 10:17 AM, Fernando Andreacci wrote:

> It worked, thanks.
>
> Is there a way to put a trend line through the boxplots?

You have not shown us how you set the data up or made the boxplots. A  
"trend line through boxplots" seems be a bit ambiguous, since the x- 
variable needs to be a factor and  a factor variable would not  
necessarily have either a scale or an order. So the answer with the  
available information cannot be anymore specific than "it depends".

-- 
David.
>
>
> On Tue, Aug 9, 2011 at 10:58 AM, David Winsemius <dwinsemius at comcast.net 
> >wrote:
>
>>
>> On Aug 9, 2011, at 9:46 AM, Fernando Andreacci wrote:
>>
>> I'm trying to make a monthly boxplot using this:
>>>
>>> boxplot(varmeasure ~ vardates)
>>>
>>> vardates = [1] 10/1/2010 10/1/2010 10/1/2010 10/1/2010 10/1/2010  
>>> 10/1/2010
>>> 10/1/2010
>>> [8] 10/1/2010 10/1/2010 11/1/2010 11/1/2010 11/1/2010 11/1/2010  
>>> 11/1/2010
>>> ....
>>>
>>> varmeasure =  [1]   0.0  26.0   0.2  -0.2  -1.2  -0.8   0.0   4.4   
>>> -0.6
>>> -0.2  14.4  -0.2
>>> [13]   4.8   4.0   2.8   3.2   3.8   3.2 -11.4   0.2   0.4   3.0    
>>> 0.6
>>> 6.2
>>> ....
>>>
>>>
>>> they have same size.
>>>
>>>
>>> My problem is that R is ploting ordered by months and not by year  
>>> and by
>>> months
>>>
>>> I'm getting 1/1/2011, 10/1/2010, 11/1/2010, 2/1/2011
>>>
>>> How can I plot it in chronological order?
>>>
>>
>> By converting those character strings to dates. At the moment you  
>> seem to
>> believe that R has the ability to "know" that you want these  
>> strings to be
>> dates.
>>
>> ?as.Date
>> ?Dates
>>
>> --
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
>
> -- 
> Fernando Andreacci
> Biólogo
> Fone +55 47 9921 4015
>        +55 41 9921 3934
> fandreacci at gmail.com
>
> 	[[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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list