Sys.setlocale: request to set locale … cannot be honored

前端 未结 2 2001
抹茶落季
抹茶落季 2021-01-02 14:36

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

2条回答
  •  孤独总比滥情好
    2021-01-02 15:22

    I have tried your code on my Windows machine and get the same error. For reference, the results of Sys.getlocale("LC_TIME"):

    > Sys.getlocale("LC_TIME")
    [1] "English_United Kingdom.1252"
    

    I suspect this might be a fairly standard locale.

    But I also suspect that the better way of approaching this problem is to use some of the functions in package lubridate, which makes it easy to work with dates.

    You don't give enough details in your question what you are tring to do, but I am guessing that "sometext" is in a specific expected format, such as DMY or YMD. Lubridate provides functions to parse dates in any specified format, e.g. dmy(), ymd(), mdy() - you get the picture.

    If you provide more details about your real problem, we might be able to help more specifically.

提交回复
热议问题