无法运行map_data("state")

无法运行map_data(

问题描述:

我试图在R中的美国地图上工作.我已经做了很多次,但是这次,当我尝试加载时,它给了我这个错误:

I am trying to work on a US map in R. I have done it a lot of times but this time it gives me this error when I try to load:

us<- map_data("state")
Error in .C(C_map_type, as.character(mapbase), integer(1)) : 
  Incorrect number of arguments (2), expecting 0 for ''

我已加载ggmap和ggplot2库.我要去哪里错了?

I have ggmap and ggplot2 libraries loaded. Where am I going wrong?

您需要与ggmap一起使用的地图"包.

You need the 'maps' package along with ggmap.

library(maps)
library(ggmap)
us<- map_data("state")

这应该有效