As.POSIXct generates an "unknown time zone" error after updating Mavericks and R on Mac OSX

I am trying to convert a string in POSIXct to R v3.1.1 on Mac OS X Mavericks (10.9.4). This worked before updating Mavericks then R. My very simple code now gives a warning, and I don't understand why: -

as.POSIXct("2014-05-24 12:45", "%Y-%m-%d %hh:%mm")
[1] "2014-05-24 12:45:00 GMT"

Warning messages:
1: In strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
  unknown timezone '%Y-%m-%d %hh:%mm'
2: In as.POSIXct.POSIXlt(x) : unknown timezone '%Y-%m-%d %hh:%mm'
3: In strptime(xx, f <- "%Y/%m/%d %H:%M:%OS", tz = tz) :
  unknown timezone '%Y-%m-%d %hh:%mm'
4: In as.POSIXct.POSIXlt(x) : unknown timezone '%Y-%m-%d %hh:%mm'
5: In strptime(xx, f <- "%Y-%m-%d %H:%M", tz = tz) :
  unknown timezone '%Y-%m-%d %hh:%mm'
6: In as.POSIXct.POSIXlt(x) : unknown timezone '%Y-%m-%d %hh:%mm'
7: In strptime(x, f, tz = tz) : unknown timezone '%Y-%m-%d %hh:%mm'
8: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) :
  unknown timezone '%Y-%m-%d %hh:%mm'
9: In as.POSIXlt.POSIXct(x, tz) : unknown timezone '%Y-%m-%d %hh:%mm'

I tried to determine the time zone using the following, but got the returned NA: -

as.POSIXct("2014-05-24 12:45", "%Y-%m-%d %hh:%mm", tz="Europe/London")

[1] NA

Not sure what I'm doing wrong here.

Thanks in advance for your help.

0
source share
1 answer

, ?strptime, , %h , %m - . %h %m

-, as.POSIXct , , tz, format, format = . tz

as.POSIXct
# function (x, tz = "", ...) 
# UseMethod("as.POSIXct")
# <bytecode: 0x0000000008ee6000>
# <environment: namespace:base>

,

as.POSIXct("2014-05-24 12:45", format = "%Y-%m-%d %H:%M")
## [1] "2014-05-24 12:45:00 IDT"
as.POSIXct("2014-05-24 12:45", "%Y-%m-%d %H:%M", tz = "Europe/London")
## [1] "2014-05-24 12:45:00 BST"
+2

Source: https://habr.com/ru/post/1669298/


All Articles