I'm curious if anyone can give me a deeper understanding of how reprex
interacts with data built into packages. For example:
library(ggplot2)
library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3
validData <- mpg
invalidData <- nc
#> Error in eval(expr, envir, enclos): object 'nc' not found
Why is it the case that reprex
can interact with data from ggplot2
or dplyr
but not from sf
?
I'm specifically interested in being able to build reproducible examples with sf
objects. It seems like the easiest way to do this would be to subset an sf
object in one that is shorter (in terms of rows) and narrower (in terms of columns), and then use dput()
. For sf
data in particular, this does not seem to be a particularly satisfying approach (given that all of the rows may be important for making the eventual ggplot2
map in the reprex).