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?

2
  • haver you tried to update ggplot ?? which version of ggplot you have ? run following code packageVersion('ggplot2')
    – Kush Patel
    Sep 12, 2017 at 21:04
  • In my question I mentioned I have ggplot2 version 2.2.1 Sep 13, 2017 at 4:06

1 Answer 1

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.

3
  • Thank you so much! This solution worked perfectly. I didn't think to pull the package directly from the Tidyverse Github repo. Sep 13, 2017 at 4: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, 2018 at 1:42
  • @user3673 I had to use install_github() for digest as well.
    – Matt
    Apr 16, 2018 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.