Re: [R] Excel date to R format

2010-04-13 Thread Ken Takagi
One useful package is "chron": example: library(chron) #convert excel time to date time format etime = 39965.0004549653 orig =chron("12/30/1899"); # "origin" of excel time. date.time = orig + etime; substr(as.character(date.time), 2, 18) # as character without parentheses. HTH, Ken __

Re: [R] Excel date to R format

2010-04-12 Thread Gabor Grothendieck
Try this: > sprintf("%.3f", as.numeric(as.POSIXct(39965.004,origin=as.Date("1970-1-1" [1] "39965.004" > getOption("digits.secs") NULL > as.POSIXct(39965.004,origin=as.Date("1970-1-1")) [1] "1970-01-01 06:06:05 EST" > sprintf("%.3f", as.numeric(as.POSIXct(39965.004,origin=as.Date("1970-1-1")))

Re: [R] Excel date to R format

2010-04-12 Thread Ben Bolker
Gabor Grothendieck gmail.com> writes: > > See the relevant article in R News 4/1. > > On Mon, Apr 12, 2010 at 10:36 AM, ManInMoon wrote: > > > > I have a vector of double like this from Excel. > > > > 39965.0004549653 > > > > and I want to put them in R such that I can display them in any Date

Re: [R] Excel date to R format

2010-04-12 Thread Gabor Grothendieck
See the relevant article in R News 4/1. On Mon, Apr 12, 2010 at 10:36 AM, ManInMoon wrote: > > I have searched and tried to read before posting but can find nothing to > accomplish change Excel dates in double format to R > > Can someone please help > > I have a vector of double like this from Ex

Re: [R] Excel date to R format

2010-04-12 Thread ManInMoon
I mean I want to convert them to whatever is the standard R DateTime class. -- View this message in context: http://n4.nabble.com/Excel-date-to-R-format-tp1837208p1837280.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-projec

[R] Excel date to R format

2010-04-12 Thread ManInMoon
I have searched and tried to read before posting but can find nothing to accomplish change Excel dates in double format to R Can someone please help I have a vector of double like this from Excel. 39965.0004549653 and I want to put them in R such that I can display them in any Date and Time fo