tidyverse干扰ggplot2?无法访问map_data

R.M*_*.M. 12 r ggplot2 tidyverse

在控制台中运行这些命令,输出为:

> 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
Run Code Online (Sandbox Code Playgroud)

我可以调用,map_data("county")直到tidyverse加载,然后失败.如何加载县地图数据tidyverse

42-*_*42- 10

测试后转移上面的评论:

我猜测虚线下面的项目来自控制台消息,但你真的应该澄清一下.似乎'purrr'中的map函数正在屏蔽'maps'包中的map函数.你可以颠倒加载tidyverse和map的顺序,如果有一个原因你需要(地理概念)"映射"超过你需要的(功能 - 计算机语言概念)"映射".您可能需要启动一个新会话才能成功.库函数检查是否已加载包,如果没有,则执行任何操作.

关于术语的评论.我的猜测是"映射"的计算机操作实际上是从"多重应用"(功能到中期结果)的收缩.如果有机会返回并将其重命名为类似于地理概念的东西,则可能将其命名为route()-ing.地理"地图"似乎是静态的二维或三维对象或"映射"以在这样的对象上放置位置.

似乎成功了:

# 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
Run Code Online (Sandbox Code Playgroud)