Re: [R] day, month, year functions

2006-08-18 Thread Gregor Gorjanc
Gabor Grothendieck wrote: On 8/17/06, Martin Maechler [EMAIL PROTECTED] wrote: Gregor == Gregor Gorjanc [EMAIL PROTECTED] on Fri, 11 Aug 2006 00:27:27 + (UTC) writes: [snip] There are two problems: 1. as.POSIXlt is not generic. (This problem may not be too important given

Re: [R] day, month, year functions

2006-08-17 Thread Martin Maechler
Gregor == Gregor Gorjanc [EMAIL PROTECTED] on Fri, 11 Aug 2006 00:27:27 + (UTC) writes: Gregor Gabor Grothendieck ggrothendieck at gmail.com writes: Here are three ways: xx - as.Date(2006-01-05) # 1. use as.POSIXlt as.POSIXlt(xx)$mday

Re: [R] day, month, year functions

2006-08-17 Thread Gregor Gorjanc
Martin Maechler wrote: Gregor == Gregor Gorjanc [EMAIL PROTECTED] on Fri, 11 Aug 2006 00:27:27 + (UTC) writes: Gregor Gabor Grothendieck ggrothendieck at gmail.com writes: Here are three ways: xx - as.Date(2006-01-05) # 1. use as.POSIXlt

Re: [R] day, month, year functions

2006-08-17 Thread Gabor Grothendieck
On 8/17/06, Martin Maechler [EMAIL PROTECTED] wrote: Gregor == Gregor Gorjanc [EMAIL PROTECTED] on Fri, 11 Aug 2006 00:27:27 + (UTC) writes: Gregor Gabor Grothendieck ggrothendieck at gmail.com writes: Here are three ways: xx - as.Date(2006-01-05) #

[R] day, month, year functions

2006-08-10 Thread Horace Tso
Hi list, I'm trying to turn a date into something productive. (Not what you may be thinking) I want three functions so I could take a date object and get the day of week, month, and year from it. xx - as.Date(2006-01-05) month(xx) equal 1 day(xx) equal 5 year(xx) equal 2006 I'm aware

Re: [R] day, month, year functions

2006-08-10 Thread Gabor Grothendieck
Here are three ways: xx - as.Date(2006-01-05) # 1. use as.POSIXlt as.POSIXlt(xx)$mday as.POSIXlt(xx)$mon + 1 as.POSIXlt(xx)$year + 1900 # 2. use format as.numeric(format(xx, %d)) as.numeric(format(xx, %m)) as.numeric(format(xx, %Y)) # 3. use month.day.year in chron package library(chron)

Re: [R] day, month, year functions

2006-08-10 Thread Gregor Gorjanc
Gabor Grothendieck ggrothendieck at gmail.com writes: Here are three ways: xx - as.Date(2006-01-05) # 1. use as.POSIXlt as.POSIXlt(xx)$mday as.POSIXlt(xx)$mon + 1 as.POSIXlt(xx)$year + 1900 # 2. use format as.numeric(format(xx, %d)) as.numeric(format(xx, %m))