On Sat, Jul 4, 2009 at 12:24 PM, Mark Knecht<markkne...@gmail.com> wrote: > On Sat, Jul 4, 2009 at 12:10 PM, Allan Engelhardt<all...@cybaea.com> wrote: >> Try help("strptime"). Example >> >> strptime(1080103L + 19e6L, "%Y%m%d") >> # [1] "2008-01-03" >> >> (This assumes your input is an integer but you can just drop the L if you >> want) >> >> >> On 04/07/09 19:37, Mark Knecht wrote: >> >> Hi, >> Is there a function that will convert this sort of date code which >> looks like "years from 1900 + month_number + day_number" with no >> spaces? As an example Jan. 3rd 2008 would be written as 1080103. >> >> Thanks, >> Mark > > Thanks. I'm building the program now that dumps all the data to csv > and wanted to make sure that I could handle this in R instead of the > app that's generating the data as it seems to be very slow at stuff > like these conversions. Looks to me like it should work so I keep > moving forward and maybe have some data in R in the next hour or two > to test. > > Cheers, > Mark >
Actually, I got there faster than I thought. The conversion works with one caveat that's been bothering me as I learn R. On this Win Vista machine R doesn't seem to know about the time zone and I don't know how to set it up correctly. > Sys.timezone() [1] "GMT" > I'm not GMT but rather PST or something like that. Win Vista says I'm GMT-8 for California, the I.O.U. state, but how do I get the platform to recognize that? The next problem is that the command appends GMT, which I don't ant, but neither do I want PST or whatever it would give me. ?strptime suggests usetz=FALSE but that doesn't seem to be accepted. See the example below. Anyway, we're very close and I appreciate your help. Cheers, Mark > TrackTrades$EnDate [1] 1080103 1080107 1080107 1080107 1080107 1080107 1080108 1080108 1080108 1080109 > strptime(TrackTrades$EnDate + 19e6L, "%Y%m%d", tz="", usetz=FALSE) Error in strptime(TrackTrades$EnDate + 19000000L, "%Y%m%d", tz = "", usetz = FALSE) : unused argument(s) (usetz = FALSE) > TrackTrades$EnDate [1] 1080103 1080107 1080107 1080107 1080107 1080107 1080108 1080108 1080108 1080109 > strptime(TrackTrades$EnDate + 19e6L, "%Y%m%d", tz="") [1] "2008-01-03 GMT" "2008-01-07 GMT" "2008-01-07 GMT" "2008-01-07 GMT" "2008-01-07 GMT" "2008-01-07 GMT" "2008-01-08 GMT" "2008-01-08 GMT" "2008-01-08 GMT" "2008-01-09 GMT" ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.