与ggplot2干扰?无法访问map_data [英] tidyverse interfering with ggplot2? cannot access map_data
问题描述
>在控制台中运行这些命令,输出为: cty0 = ggplot2 :: map_data(county)
>库(tidyverse)
加载tidyverse:ggplot2
加载tidyverse:tibble
加载tidyverse:tidyr
加载tidyverse:readr
加载tidyverse:purrr
加载tidyverse :dplyr
与整洁软件包冲突---------------------------------------- -------------------------------------------------- -----
filter():dplyr,stats
lag():dplyr,stats $ b $ map():purrr,maps
> cty0 = ggplot2 :: map_data(county)
错误:ggplot2不知道如何处理class列表中的数据
我可以调用 map_data(county)
,直到加载 tidyverse
那么它就会失败。如何通过 tidyverse
加载加载县地图数据?
在测试之后从上面传递了评论:
我猜测虚线以下的项目来自控制台消息
,但你真的应该澄清。似乎'purrr'中的地图功能掩盖了'maps'包中的地图功能。如果您需要映射(的地理概念)比您需要(映射)的(功能 - 计算机语言概念)更多的原因,则可以颠倒加载tidyverse和映射的顺序。您可能需要开始新的会话才能成功。库函数检查一个包是否已经被加载,如果是这样的话,什么也不做。
对术语的评论。我的猜测是,映射的计算机操作实际上是从多种应用程序(一种功能到临时结果)的收缩。如果有机会返回并将其重命名为与地理概念类似的内容,则可以将其命名为 route()
-ing。地理上的地图似乎是一个静态的二维或三维对象或贴图,以便在这样的对象上放置位置。
似乎成功了:
#在新鲜的会话中(默认情况下,我的个人资料会附加ggplot2)
>库(tidyverse)
加载tidyverse:tibble
加载tidyverse:tidyr
加载tidyverse:readr
加载tidyverse:purrr
加载tidyverse:dplyr
冲突整洁的软件包---------------------------------
combine():dplyr,Hmisc#加载到我的.Rprofile;还附加了gglot2
filter():dplyr,stats
lag():dplyr,stats
matches():dplyr,sos #from .Rprofile; ():dplyr,Hmisc
summary():dplyr,Hmisc
> cty0 = ggplot2 :: map_data(county)
附加包:'maps'
下面的对象被'package:purrr'掩盖:
map
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
这篇关于与ggplot2干扰?无法访问map_data的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!