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