12

I'm currently running R Version 3.3.3 on Windows and have ggplot2 version 2.2.1 and the sf package version 0.5-4 and am getting an error saying that R could not find the function "geom_sf."

I expected to find the function because it is listed in Tidyverse documentation at http://ggplot2.tidyverse.org/reference/ggsf.html.

The output of ls("package:ggplot2") did not show "geom_sf" as an included function and I could not find it in the library files.

Does anyone know how I might get this elusive package?

pogibas
  • 27,303
  • 19
  • 84
  • 117
Arcenis Rojas
  • 174
  • 2
  • 11

1 Answers1

14

While running R as the administrator, reinstall ggplot2 like this:

devtools::install_github("tidyverse/ggplot2")
require(ggplot2)

You should be able to see it now with ?geom_sf

For questions related to using devtools, see this SO answer.

www
  • 4,124
  • 1
  • 11
  • 22
  • Thank you so much! This solution worked perfectly. I didn't think to pull the package directly from the Tidyverse Github repo. – Arcenis Rojas Sep 13 '17 at 04:19
  • 1
    Same problem with R version 3.4 and I got `ERROR: dependency 'digest' is not available for package 'ggplot2'` with the above solution. – user3673 Mar 12 '18 at 01:42
  • @user3673 I had to use `install_github()` for `digest` as well. – Matt Apr 16 '18 at 17:31