问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/42638145/timezone-error-reading-csv