Sebastien Moretti
2017-Apr-06 06:55 UTC
[R] as.POSIXct character string is not in a standard unambiguous format
Hi Ben Thanks for your answer I have already tried this, as well as x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M")) It works! But it does not fix it widely for all tests used during the "make check" step at compile time. Unless I patch all of them. There is something with localtime but I cannot find what. On another machine with another Linux OS, and the same environmental variables x <- as.POSIXct("2002-02-02 02:02") works fine. S?bastien> Hi, > > I can't answer the question about R 3.3.3, but I don't see anything in the update notes. > > http://mirror.its.dal.ca/cran/doc/manuals/r-release/NEWS.html > > In the meantime, would it skirt your issue if you explicitly stated the format? > > x <- as.POSIXct("2002-02-02 02:02", format = "%Y-%m-%d %H:%M") > > Ben > > > >> On Apr 5, 2017, at 11:21 AM, Sebastien Moretti <sebastien.moretti at unil.ch> wrote: >> >> Hi >> >> I have lots of issues when I try to install R 3.3.3 during the "make check" step. >> >> Every time a call to as.POSIXct is done in test scripts, I got the same error message: >> e.g. x <- as.POSIXct("2002-02-02 02:02") >> Error in as.POSIXlt.character(x, tz, ...) : >> character string is not in a standard unambiguous format >> >> >> It looks to be linked to localtime but when I compiled R 3.3.2 6 months ago, the same test scripts were there and succeeded. >> >> >> Is there an environmental variable to use to change the as.POSIXct behavior? >> >> Regards >> >> -- >> S?bastien >> >> ______________________________________________ >> 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. > > Ben Tupper > Bigelow Laboratory for Ocean Sciences > 60 Bigelow Drive, P.O. Box 380 > East Boothbay, Maine 04544 > http://www.bigelow.org
Sebastien Moretti
2017-Apr-06 12:29 UTC
[R] as.POSIXct character string is not in a standard unambiguous format
I have just found the solution. We have a custom Linux distribution that allows us to have several R (+ glibc and others) versions in parallel for tools related to our job domain. We have another etc/ folder for those tools and R looks for the localtime file there, not in /etc/. So linking /etc/localtime to our etc/ folder makes R happy and x <- as.POSIXct("2002-02-02 02:02") works fine! S?bastien> Hi Ben > > Thanks for your answer > I have already tried this, as well as > x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M")) > It works! But it does not fix it widely for all tests used during the > "make check" step at compile time. Unless I patch all of them. > > There is something with localtime but I cannot find what. > > On another machine with another Linux OS, and the same environmental > variables > x <- as.POSIXct("2002-02-02 02:02") > works fine. > > S?bastien > >> Hi, >> >> I can't answer the question about R 3.3.3, but I don't see anything in >> the update notes. >> >> http://mirror.its.dal.ca/cran/doc/manuals/r-release/NEWS.html >> >> In the meantime, would it skirt your issue if you explicitly stated >> the format? >> >> x <- as.POSIXct("2002-02-02 02:02", format = "%Y-%m-%d %H:%M") >> >> Ben >> >> >> >>> On Apr 5, 2017, at 11:21 AM, Sebastien Moretti >>> <sebastien.moretti at unil.ch> wrote: >>> >>> Hi >>> >>> I have lots of issues when I try to install R 3.3.3 during the "make >>> check" step. >>> >>> Every time a call to as.POSIXct is done in test scripts, I got the >>> same error message: >>> e.g. x <- as.POSIXct("2002-02-02 02:02") >>> Error in as.POSIXlt.character(x, tz, ...) : >>> character string is not in a standard unambiguous format >>> >>> >>> It looks to be linked to localtime but when I compiled R 3.3.2 6 >>> months ago, the same test scripts were there and succeeded. >>> >>> >>> Is there an environmental variable to use to change the as.POSIXct >>> behavior? >>> >>> Regards >>> >>> -- >>> S?bastien
Jeff Newmiller
2017-Apr-06 14:43 UTC
[R] as.POSIXct character string is not in a standard unambiguous format
You always need to set your timezone somehow when converting to POSIXt. Technically the method for doing this varies by OS, but on all environments I have worked with you can set the default timezone with something like Sys.setenv( TZ="Etc/GMT+5" ) In your example, some timezones supporting daylight savings would regard that time as invalid (clock "jumps forward"). If the default ("system") timezone on a particular server does not match the data you are working with, use the above command to make it easy to work with data from the desired timezone temporarily. Read ?timezones. -- Sent from my phone. Please excuse my brevity. On April 5, 2017 11:55:34 PM PDT, Sebastien Moretti <sebastien.moretti at unil.ch> wrote:>Hi Ben > >Thanks for your answer >I have already tried this, as well as > x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M")) >It works! But it does not fix it widely for all tests used during the >"make check" step at compile time. Unless I patch all of them. > >There is something with localtime but I cannot find what. > >On another machine with another Linux OS, and the same environmental >variables > x <- as.POSIXct("2002-02-02 02:02") >works fine. > >S?bastien > >> Hi, >> >> I can't answer the question about R 3.3.3, but I don't see anything >in the update notes. >> >> http://mirror.its.dal.ca/cran/doc/manuals/r-release/NEWS.html >> >> In the meantime, would it skirt your issue if you explicitly stated >the format? >> >> x <- as.POSIXct("2002-02-02 02:02", format = "%Y-%m-%d %H:%M") >> >> Ben >> >> >> >>> On Apr 5, 2017, at 11:21 AM, Sebastien Moretti ><sebastien.moretti at unil.ch> wrote: >>> >>> Hi >>> >>> I have lots of issues when I try to install R 3.3.3 during the "make >check" step. >>> >>> Every time a call to as.POSIXct is done in test scripts, I got the >same error message: >>> e.g. x <- as.POSIXct("2002-02-02 02:02") >>> Error in as.POSIXlt.character(x, tz, ...) : >>> character string is not in a standard unambiguous format >>> >>> >>> It looks to be linked to localtime but when I compiled R 3.3.2 6 >months ago, the same test scripts were there and succeeded. >>> >>> >>> Is there an environmental variable to use to change the as.POSIXct >behavior? >>> >>> Regards >>> >>> -- >>> S?bastien >>> >>> ______________________________________________ >>> 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. >> >> Ben Tupper >> Bigelow Laboratory for Ocean Sciences >> 60 Bigelow Drive, P.O. Box 380 >> East Boothbay, Maine 04544 >> http://www.bigelow.org > >______________________________________________ >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.
Jeff Newmiller
2017-Apr-06 14:45 UTC
[R] as.POSIXct character string is not in a standard unambiguous format
I cannot imagine a less desirable solution. This is the opposite of portable programming. -- Sent from my phone. Please excuse my brevity. On April 6, 2017 5:29:08 AM PDT, Sebastien Moretti <sebastien.moretti at unil.ch> wrote:>I have just found the solution. > >We have a custom Linux distribution that allows us to have several R (+ > >glibc and others) versions in parallel for tools related to our job >domain. > >We have another etc/ folder for those tools and R looks for the >localtime file there, not in /etc/. >So linking /etc/localtime to our etc/ folder makes R happy and > x <- as.POSIXct("2002-02-02 02:02") >works fine! > >S?bastien > >> Hi Ben >> >> Thanks for your answer >> I have already tried this, as well as >> x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M")) >> It works! But it does not fix it widely for all tests used during the >> "make check" step at compile time. Unless I patch all of them. >> >> There is something with localtime but I cannot find what. >> >> On another machine with another Linux OS, and the same environmental >> variables >> x <- as.POSIXct("2002-02-02 02:02") >> works fine. >> >> S?bastien >> >>> Hi, >>> >>> I can't answer the question about R 3.3.3, but I don't see anything >in >>> the update notes. >>> >>> http://mirror.its.dal.ca/cran/doc/manuals/r-release/NEWS.html >>> >>> In the meantime, would it skirt your issue if you explicitly stated >>> the format? >>> >>> x <- as.POSIXct("2002-02-02 02:02", format = "%Y-%m-%d %H:%M") >>> >>> Ben >>> >>> >>> >>>> On Apr 5, 2017, at 11:21 AM, Sebastien Moretti >>>> <sebastien.moretti at unil.ch> wrote: >>>> >>>> Hi >>>> >>>> I have lots of issues when I try to install R 3.3.3 during the >"make >>>> check" step. >>>> >>>> Every time a call to as.POSIXct is done in test scripts, I got the >>>> same error message: >>>> e.g. x <- as.POSIXct("2002-02-02 02:02") >>>> Error in as.POSIXlt.character(x, tz, ...) : >>>> character string is not in a standard unambiguous format >>>> >>>> >>>> It looks to be linked to localtime but when I compiled R 3.3.2 6 >>>> months ago, the same test scripts were there and succeeded. >>>> >>>> >>>> Is there an environmental variable to use to change the as.POSIXct >>>> behavior? >>>> >>>> Regards >>>> >>>> -- >>>> S?bastien > >______________________________________________ >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.