nevrome / covid19germany

R package - Load, visualise and analyse daily updated data on the COVID-19 outbreak in Germany
Other
46 stars 8 forks source link

cronjob fails due to {sf} call #30

Closed arne1921KF closed 4 years ago

arne1921KF commented 4 years ago

Short note (sorry, not time to fix or even write a proper issue, in between meetings!): calling get_RKI_spatial in a linux cronjob gives me an error R packages sf needed for this function to work. Please install with install.packages(c('sf')). {sf} is installed and available, and even attached. Running the script on the same machine from R Studio server works flawlessly.

I guess (!) your call sf_object <- sf::read_sf(file.path(unzip_dir, "BL_mit_EW_und_Faellen.shp")) %>% might try to call it into a different environment, or something like this?

Not sure how to handle this, maybe attach {sf} within the function?

If the problem is on my side, however, I'd appreciate help how to solve this.

arne1921KF commented 4 years ago

Closing this: I realised that I 1) need to set up the environment for the cronjob, and 2) the machine I used had a misconfigured gdal, and some other issues. I still have to install, load and attach {sf} apparently for every session, though. Something is at odds, but maybe not {covid19germany}.

nevrome commented 4 years ago

Hey - I'm on holiday right now so sorry for coming back to you late.

sf is only in the Suggests field of the DESCRIPTION file, so it is not installed automatically. I opted for that solution to safe users that only need the timeseries the time to install sf (with all it's complicated system dependencies).

If you want to use the spatial data in some sort of automatic pipeline you should use an install command for covid19germany that also installs the Suggests dependencies.