Bizzare as.POSIXct behavior for some timestamp with time part dropping

I struggled with read.csv with colClasses containing POSIXct, rounded the entire column with timestamps to the current date. I stumbled upon a similar question , suggesting that some date that I can might skip part of the time. That was not so. However, after halving my vector, I noticed that some specific time stamps were to blame. Here is a snippet.

as.POSIXct(c("2016-03-13 01:00:00", "2016-03-13 02:00:00", "2016-03-13 03:00:00"))

It gives me

[1] "2016-03-13 CST" "2016-03-13 CST" "2016-03-13 CST"

It's about daylight saving time, but nonetheless, where is the time part? This is mistake?

> version
               _                           
platform       i386-w64-mingw32            
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          3                           
minor          3.0                         
year           2016                        
month          05                          
day            03                          
svn rev        70573                       
language       R                           
version.string R version 3.3.0 (2016-05-03)
nickname       Supposedly Educational      

Update

While setting the time zone on a global scale seems to overcome the problem, it still looks like an error to me.

Update 2

, Windows ( ?) R 3.2.3 Ubuntu

[1] "2016-03-13 01:00:00 CST" "2016-03-13 01:00:00 CST"
[3] "2016-03-13 03:00:00 CDT"

3

# 16852.

4

- , % S % OS, .

> strptime(c("2016-03-13 01:00:00", "2016-03-13 02:00:00", "2016-03-13 03:00:00"), "%Y-%m-%d %H:%M:%S")
[1] "2016-03-13 01:00:00 CST" "2016-03-13 02:00:00"     "2016-03-13 03:00:00 CDT"
> strptime(c("2016-03-13 01:00:00", "2016-03-13 02:00:00", "2016-03-13 03:00:00"), "%Y-%m-%d %H:%M:%OS")
[1] "2016-03-13 01:00:00 CST" "2016-03-13 02:00:00"     "2016-03-13 03:00:00 CDT"

P.S. ...:/

+4

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


All Articles