3

After googling for a couple of hours I have not found a solution to this problem. Basically when I run read_csv("some_file.csv") function from readr package I get the following error:

Error: Unknown TZ UTC

and csv is not read.

The only way I can read the CSV is this way:

read_csv("some_file.csv",locale=locale(tz="Australia/Sydney"))

Sydney being my timezone.

But I'd rather fix the error than work around it if possible. Does anybody know how to fix the UTC error permanently? E.g. Startup instructions? Ta.

jc52766
  • 159
  • 2
  • 9

1 Answers1

5

the locale input argument is set to default_locale(). When you print out the default_locale function, you can see that it read in the locale from options.

To set the locale permanently so that it is set every time you start R, you can add the following line to your ~PATH_TO_R~/etc/Rprofile.site

options(readr.default_locale=readr::locale(tz="Australia/Sydney"))

For temporary solution, just add this line at the top of your script

chinsoon12
  • 25,005
  • 4
  • 25
  • 35
  • Thanks Chinsoon. I've updated my Rprofile.site file. Actually working back from where the default_locale function is so obvious. This approach will save me many a headache in the future. Thanks. – jc52766 Mar 07 '17 at 01:48