I\'m using strptime(...)
in a function of my package. I need to parse a string using specific local settings and used Sys.setlocale
as a workaround
I am quite sure that the "en_GB.UTF-8" locale is not installed on your college's computer. The easiest way could be to install it :) Well, this is not trivial with every OS.
Other option could be to use a standard locale which can be found on every computer. As your added example shows no special format, you could try with setting LC_TIME
to C
, which works under Linux and Windows also. With that locale, your given example will work like a charm. See:
> Sys.setlocale("LC_TIME", "C")
> strptime("Mon, 14 Mar 2011 23:42:16 GMT", format = "%a, %d %b %Y %H:%M:%S", tz="GMT")
[1] "2011-03-14 23:42:16 GMT"
Or otherwise you should transform your data - e.g.: write a short function to substitute all week- and months' name to standard strings and restructure your imported strings to standard ones.