[R] Shaded areas in R

Duncan Murdoch murdoch.duncan at gmail.com
Thu May 26 17:12:42 CEST 2016

On 26/05/2016 11:03 AM, Óscar Jiménez wrote:
> Hi Duncan,
> Thanks for the quick reply  :)
> Does the function Sys.Date return a time series (created with the 
> function POSIXct), with numerical values?

It returns a Date object.  The str() function will show you that. But 
Date, POSIXct, and even POSIXlt are supported by many of the graphics 
functions, so you don't need to worry about the conversions.

> I mean... I think the best option is to convert the time series 
> (plotted as characters), into numerical values, right?

No, that is not needed.

> Or is there any other function that allows me to draw the shade under 
> the curve using time series as the "x" variable?

polygon() does.

You should try things; R won't break.
> If you need more info I can share my script and my database and you 
> can see it properly.

You should always do that when you pose your question; you should also 
send your questions to R-help, not privately.  I've cc'd my response there.

Duncan Murdoch

More information about the R-help mailing list