Running these commands in the console, the output is:
> cty0 = ggplot2::map_data("county")
> library(tidyverse)
Loading tidyverse: ggplot2
Loading tidyverse: tibble
Loading tidyverse: tidyr
Loading tidyverse: readr
Loading tidyverse: purrr
Loading tidyverse: dplyr
Conflicts with tidy packages -----------------------------------------------------------------------------------------------
filter(): dplyr, stats
lag(): dplyr, stats
map(): purrr, maps
> cty0 = ggplot2::map_data("county")
Error: ggplot2 doesn't know how to deal with data of class list
I can call map_data("county")
fine until tidyverse
is loaded, then it fails. How do I load a county map data with tidyverse
loaded?
Transferred the comment from above after testing:
I'm guessing that the items below the dashed line are from the console messages
, but you really should clarify that. Seems likely that the map function in 'purrr' is masking the map function in the 'maps' package. You could reverse the order of loading tidyverse and maps if there were a reason that you needed the (geographic notion of) "mapping" more than you needed the (functional-computer language notion of) "mapping". You probably need to start a new session for that to succeed. The library function checks to see of a package is already loaded and if so does nothing.
A comment on terminology. My guess is that the computer operation of "mapping" is actually a contraction from "multiple application" (of a function to interim results). If there were a chance to go back and rename it to something that would be similar to a geographic concept, it might be named route()
-ing. A geographic "map" would seem to be a static two or three-dimensional object or "mapping" to be placement of positions on such an object.
Seems to succeed:
# In a fresh session (and my profile attaches ggplot2 by default)
> library(tidyverse)
Loading tidyverse: tibble
Loading tidyverse: tidyr
Loading tidyverse: readr
Loading tidyverse: purrr
Loading tidyverse: dplyr
Conflicts with tidy packages ---------------------------------
combine(): dplyr, Hmisc # loaded in my .Rprofile; also attaches gglot2
filter(): dplyr, stats
lag(): dplyr, stats
matches(): dplyr, sos #from .Rprofile; doesn't seem to clobber findFn function
src(): dplyr, Hmisc
summarize(): dplyr, Hmisc
> cty0 = ggplot2::map_data("county")
Attaching package: ‘maps’
The following object is masked from ‘package:purrr’:
map
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