Re: [R] problems in vectors of dates_times

2017-04-07 Thread Richard M. Heiberger
Don asks a good question. Here is the analogy from the grid package. > library(grid) > unit(12, "in") [1] 12in > unit(12, "cm") [1] 12cm > unit.c(unit(12, "in"), unit(12, "cm")) [1] 12in 12cm > c(unit(12, "in"), unit(12, "cm")) [1] 12 12 > ?unit > convertUnit(c(unit(12, "in"), unit(12, "cm")), "i

Re: [R] problems in vectors of dates_times

2017-04-07 Thread MacQueen, Don
I think a more illuminating inspection is this: > attributes(A) $class [1] "POSIXct" "POSIXt" $tzone [1] "UTC" > attributes(B) $class [1] "POSIXct" "POSIXt" $tzone [1] "UTC" > attributes(C) $class [1] "POSIXct" "POSIXt" Note that the operation c(A,B) loses the $tzone attribute. Note also

Re: [R] problems in vectors of dates_times

2017-04-07 Thread William Michels via R-help
I believe the lubridate package does a good job with time zones. > install.packages("lubridate") > library(lubridate) Look at the supplied functions with_tz() and force_tz(). HTH, Bill. William J. Michels, Ph.D. On Fri, Apr 7, 2017 at 12:52 AM, Jeff Newmiller wrote: > R does a poor job

Re: [R] problems in vectors of dates_times

2017-04-07 Thread Jeff Newmiller
R does a poor job of supporting timezone-specific objects... you have to transfer the necessary attributes explicitly for many operations. (It does no job of supporting element-specific timezones so don't go there.) The good news is that R is pretty good at working with points in time, since t

Re: [R] problems in vectors of dates_times

2017-04-07 Thread Troels Ring
Thanks a lot - good idea: I put Sys.setenv(TZ = "UTC") ahead of the code - solves the problem! Thanks a lot Den 07-04-2017 kl. 09:26 skrev Mark Leeds: > Hi Troels: This is off-list so as to not clog the list with my noise > because my suggestion may not work. I really don't know that much >

Re: [R] problems in vectors of dates_times

2017-04-07 Thread Troels Ring
Thanks a lot - perhaps it is just understanding how times dates are handled, sorry to bother if that is just the case C[1]==A[1] # TRUE but C[1] [1] "2013-03-28 07:00:00 CET" A[1] [1] "2013-03-28 06:00:00 UTC" Den 07-04-2017 kl. 08:27 skrev Ulrik Stervbo: Hi Troels, I get no error. I

Re: [R] problems in vectors of dates_times

2017-04-06 Thread Ulrik Stervbo
Hi Troels, I get no error. I think we need more information to be of any help. Best wishes, Ulrik On Fri, 7 Apr 2017 at 08:17 Troels Ring wrote: > Dear friends - I have further problems handling dates_times, as > demonstrated below where concatenating two formatted vectors of > date_times res

[R] problems in vectors of dates_times

2017-04-06 Thread Troels Ring
Dear friends - I have further problems handling dates_times, as demonstrated below where concatenating two formatted vectors of date_times results in errors. I wonder why this happens and what was wrong in trying to take these two vectors together All best wishes Troels Ring Aalborg, Denmark W