[R] Help with strftime error "character string is not in a standard unambiguous format"
Enrico Schumann
es at enricoschumann.net
Mon Sep 12 11:05:44 CEST 2016
On Mon, 12 Sep 2016, Chris Evans <chrishold at psyctc.org> writes:
> I am trying to read activity data created by Garmin. It outputs dates like this:
>
> "Thu, 25 Aug 2016 6:34 PM"
>
> The problem that has stumped me is this:
>
>> strftime("Thu, 25 Aug 2016 6:34 PM",format="%a, %d %b %Y %I:%M %p")
> Error in as.POSIXlt.character(x, tz = tz) :
> character string is not in a standard unambiguous format
Didn't you mean strptime?
^
> strptime("Thu, 25 Aug 2016 6:34 PM",format="%a, %d %b %Y %I:%M %p")
## [1] "2016-08-25 18:34:00 CEST"
> I _thought_ I had this running OK but that error is catching me now.
> I think I've read ?strftime and written that format string correctly
> to match the input but I'm stumped now.
>
> Can someone advise me? Many thanks in advance,
>
> Chris
>
>
>> sessionInfo()
> R version 3.3.1 (2016-06-21)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 10586)
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252
> [2] LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] compiler_3.3.1 tools_3.3.1
>>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net
More information about the R-help
mailing list