A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ropensci/FedData/issues/61 below:

get_ssurgo fails for non-us locale · Issue #61 · ropensci/FedData · GitHub

Hi, I have Polish locale configured on my system (pl_PL).
I noticed that it affects dates parsing and leads to errors with downloading SSURGO files:

(Down)Loading SSURGO data for survey area 1 of 7: CO669
Downloading file: http://websoilsurvey.sc.egov.usda.gov/DSD/Download/Cache/SSA/wss_SSA_CO669_[NA].zip
Ostrzeżenie w poleceniu 'utils::unzip(file, exdir = tmpdir)':
  błąd 1 podczas rozpakowywania pliku zip

Notice the [NA] in the filename instead of the date. This is caused by the fact that with non-english locale as.Date with the "%b %d %Y" format cannot parse the month name from the saverest field.

I managed to overcome this problem by setting the locale manually in the R console:

Sys.setlocale("LC_TIME", 'en_US.UTF-8')

However, maybe it would be a good idea to wrap the calls to as.Date with the code that changes the locale temporarily?
For example:

currentTimeLocale<-Sys.getlocale("LC_TIME")
Sys.setlocale("LC_TIME",  'en_US.UTF-8')
x<-as.Date("Jun  8 2020  5:12PM", format = "%b %d %Y")
Sys.setlocale("LC_TIME", currentTimeLocale)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4