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?
The problem is that geom_sf () doesn't have access to the plot data. However, it should work if you supply the data directly. Sorry, something went wrong. With which command? (I have had problems reproducing a case posted to r-sig-geo) Sorry, something went wrong. Your final example should work: Sorry, something went wrong.
Error in ggplot(df, aes(x = x, y = y)) : could not find function "ggplot" This error occurs when you attempt to create a plot using the ggplot2 data visualization package, but have failed to load the package first. This tutorial explains five potential ways to fix this error. How to Reproduce this Error. Suppose we run the following code in R:
Do nothing: by default geom_sf () assumes it is stored in the geometry column. Explicitly pass an sf object to the data argument. This will use the primary geometry column, no matter what it's called. Unlike other aesthetics, geometry will never be inherited from the plot. coord_sf () ensures that all layers use a common CRS.
Visualise sf objects — ggsf This set of geom, stat, and coord are used to visualise simple feature (sf) objects. For simple plots, you will only need geom_sf() as it uses stat_sf() and adds coord_sf() for you. geom_sf() is an unusual geom because it will draw different...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With