[R-SIG-Finance] Seasonal plot of daily data

Gabor Grothendieck ggrothendieck at gmail.com
Tue Aug 3 23:35:44 CEST 2010

On Tue, Aug 3, 2010 at 2:42 AM, SNV Krishna <krishna at primps.com.sg> wrote:
> Hi Gabor,
> many thanks for the solution and it worked.
> I tried a lot in getting appropriate function to extract year or month from
> the date, but could not. Your suggestion of using cut() is great, and I have
> not come across this function. Later I saw on help file, but its usage to
> extract year from date was not mentioned. By the way can you mention any
> other function that are useful in extracting year or month or week number or
> day?

today <- Sys.Date()
as.numeric(format(today, "%Y"))  # see ?strptime
as.POSIXlt(today)$year + 1900)
as.numeric(substr(today, 1, 4))
library(chron); month.day.year(today)$year

Also see R News 4/1 .

> also can you tell what is 'seq_along'?

seq_along(x) returns 1, 2, 3, ..., length(x). See ?seq_along

More information about the R-SIG-Finance mailing list