Hi
Every time I start a new project in RStudio, I get the following warning message.
Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) :
unknown timezone 'default/America/Los_Angeles'
I am not really sure, how to make the time zone persist in the system settings within RStudio.
I am using RStudio: Version 1.0.153 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.38 (KHTML, like Gecko)
All my scripts/notebooks now have an additional command Sys.setenv (TZ="America/Los_Angeles) to fix this warning.
The real fix is to fix your system environment/timezone to something that R understands, I think. However, a Mac person would have to help out with that.
That said, this is one potential situation where a .Rprofile would make sense (as a hacky fix) -- if you create a file named .Rprofile in your home directory with the command Sys.setenv(TZ = "America/Los_Angeles") in it, that would run by default every time you run R.
I am running into this problem too when I load a package I am working on. I think it is somehow related to the lubridate package (but I doubt it is causing the problem) but I have been not able to make a reproducible error I can dig into. Look at this example of running lubridate::tz() twice in the console:
lubridate::tz(lubridate::ymd("2016-03-26"))
Error in as.POSIXlt.POSIXct(x, tz) :
(converted from warning) unknown timezone 'default/America/New_York'
lubridate::tz(lubridate::ymd("2016-03-26"))
[1] "UTC"
The first time it produces the unknown timezone and the second time it produce UTC
Once I get time to track it down I'll get back to this thread with what I found but it may be a while.
Sorry I was away at a meeting. I tried different versions of R as well, I would like to POSIT that this issue is a macOS issue, I started noticing it after the new macOS HighSierra update.
The bug report Nick reference started by saying it was a macOS issue but finally concluded that it was an R build issue (that hit change in macOS). It said that by building R with the right command line switches the problem would go away. It also said the problem was gone in the current build too
The most obvious downside is that, if you change your computer's timezone, R will still use the old one. It also won't fix other users or system users, so scripts run as root or similar would still throw errors. It looks like you can also put a .Rprofile in the R HOME directory (use R.home() to see where it is), which would execute for all users unless they create their own .Rprofile and put it in their home directory (or a project directory).
Overall, it's a fairly innocent "hack" and probably the most straightforward option until it's fixed by the R project or Apple (can't tell who is actually to blame in this case).
Good. We have to then restart R after this file is added to the system.
By the way, is this a standard way to set the timezone for all who have upgraded to HighSierra? If yes we will have to put this in the FAQ for mac installation. Also can't we add this step in the installation process?