R/textToEuropeBerlinPosix.R
textToEuropeBerlinPosix.Rd
This function tries to overcome some problems that may arise when using
as.POSIXct
. It can handle timestamps that originate from a
clock that switches between standard time and summer time as well as those
originating from a clock that stays in standard time over the whole year.
See vignette("text_to_posixct", package = "kwb.datetime")
for details.
It also tries to find a convenient format description string.
textToEuropeBerlinPosix(x, format = NULL, switches = TRUE, dbg = TRUE, ...)
x | vector of text (i.e. character) timestamps |
---|---|
format | format string describing the format of a timestamp, such as
"
placeholders. If not given or |
switches | if |
dbg | if |
... | further arguments passed to |
vector of POSIXct objects
When reading timestamps that observe Daylight Saving, it is required that
the timestamps in x
are ordered by time, which should be the case if
they were recorded by a measuring device.
#> begin end #> "2019-03-31" "2019-10-27"#> Guessing time format ... ok. (0.01s) #> Converting 2 timestamps to POSIXct ... ok. (0.01s)#> Guessing time format ... ok. (0.01s) #> Converting 2 timestamps to POSIXct ... ok. (0.00s)#> [1] TRUE#> Guessing time format ... ok. (0.01s) #> Converting 2 timestamps to POSIXct ... ok. (0.01s)#> Guessing time format ... ok. (0.01s) #> Converting 2 timestamps to POSIXct ... ok. (0.00s)#> [1] TRUEkwb.datetime::textToEuropeBerlinPosix(c( "2017-10-29 01:30:00", # 1: CEST "2017-10-29 02:00:00", # 2: CEST "2017-10-29 02:30:00", # 3: CEST "2017-10-29 02:00:00", # 4: CET "2017-10-29 02:30:00", # 5: CET "2017-10-29 03:00:00" # 6: CET ))#> Guessing time format ... ok. (0.01s) #> Converting 6 timestamps to POSIXct ... ok. (0.01s)#> [1] "2017-10-29 01:30:00 CEST" "2017-10-29 02:00:00 CEST" #> [3] "2017-10-29 02:30:00 CEST" "2017-10-29 02:00:00 CET" #> [5] "2017-10-29 02:30:00 CET" "2017-10-29 03:00:00 CET"