Error: could not find function "geom_sf"

I am currently running R version 3.4.2 on Windows and have ggplot2 (via tidyverse) and sf version 3.4.2. I am trying to map spatial data using the ggplot2 sf set.

When I try to start geom_sf, I get an error message: could not find function "geom_sf" .

When I view the ggplot2 package using ls("package:ggplot2") , geom_sf is not listed in the library files.

I installed devtools and ran devtools::install_github("tidyverse/ggplot2") . However, I get an error message: Installation failed: Failed to connect to raw.githubusercontent.come port 443: Timed out . I assume that the firewall at work stops this connection.

To get around this, I tried to download the zip manually from https://github.com/tidyverse/ggplot2 and run install.packages('ggplot2-master.zip', lib = 'C:/filepath') and get an error message: package 'ggplot2-master.zip' is not available (for R version 3.4.2) , I got the same error before upgrading from 3.4.1.

TL; DR : I have the same problem as this user: Error building sf --- Error: could not find function "geom_sf"; but the solution does not work for me.

Does anyone see where I can skip something? Or how to access this high-level (more ordered) package?

+5
source share
1 answer

If you downloaded the URL you provided, the next next step is to do this on the command line of the R session, assuming your package is in the working directory:

 install.packages('ggplot2', repo=NULL, lib = 'C:/filepath') 

The .zip extension is implicitly trying to install from a Windows binary, and you need to tell it NOT to try to download from CRAN.

+1
source

Source: https://habr.com/ru/post/1272731/


All Articles