its-pointless.github.io icon indicating copy to clipboard operation
its-pointless.github.io copied to clipboard

R package readr searching for time zone info from locale fails

Open linusjf opened this issue 5 years ago • 0 comments

#2796 (comment)

Problem description Readr package readr function fails to locate time zone info.

Steps to reproduce

#!/usr/bin/env Rscript
library(readr)

main <- function(argv) {
teams <- readr::read_csv("team_standings.csv", col_types = "ic",
locale = locale(tz = "Asia/Kolkata"))
print(teams)
return(0)
}

if (identical(environment(), globalenv())) {
quit(status = main(commandArgs(trailingOnly = TRUE)))
}

Csv file:

"Standing","Team"
1,"Spain"
2,"Netherlands"
3,"Germany"
4,"Uruguay"
5,"Argentina"
6,"Brazil"
7,"Ghana"
8,"Paraguay"
9,"Japan"
10,"Chile"
11,"Portugal"
12,"USA"
13,"England"
14,"Mexico"
15,"South Korea"
16,"Slovakia"
17,"Ivory Coast"
18,"Slovenia"
19,"Switzerland"
20,"South Africa"
21,"Australia"
22,"New Zealand"
23,"Serbia"
24,"Denmark"
25,"Greece"
26,"Italy"
27,"Nigeria"
28,"Algeria"
29,"France"
30,"Honduras"
31,"Cameroon"
32,"North Korea"

Error message: $ ./readteamstandings.R Error: Unknown TZ UTC (when no locale specified) In addition: Warning message: In OlsonNames() : no Olson database found Execution halted

Expected behavior Script should display first 10 records as follows:

# A tibble: 32 x 2
  Standing Team
     <int> <chr>
 1        1 Spain
 2        2 Netherlands
 3        3 Germany
 4        4 Uruguay
 5        5 Argentina
 6        6 Brazil
 7        7 Ghana
 8        8 Paraguay
 9        9 Japan
10       10 Chile
# … with 22 more rows

The above script performs as expected on ArchLinux on Termux.

linusjf avatar Jan 19 '20 16:01 linusjf