我正在基于具体变量创建地图。但是,R一直给我警告“忽略未知的美学:x”,尽管我的数据集中包含了替换x的变量。我怎样才能解决这个问题?
我已经从另一个脚本中检索到了我正在使用的函数,该脚本在其中可以正常工作,因此我不知道出了什么问题。
#the code I am using
Oil <- read_csv2(file = "C:/Users/Gebruiker/Documents/CrudeOil2.csv")
locationOil_df <- geocode(Oil$`Location,`)
NewOil2 <- cbind(Oil, locationOil_df)
NewOil2_2008 <- as.data.frame(NewOil2_2008)
> NewOil2_2008
X1 id, Name,
216 NA 216, Bandar Abbas Refinery,
217 NA 217, Esfahan Refinery,
218 NA 218, Kermansheh Refinery,
219 NA 219, Abadan Refinery,
220 NA 220, Shiraz Refinery,
Owner, Location, Type,
216 NIOC(Government), Bandar Abbas, Production,
217 Isfahan Oil Refining Company(Government), Esfahan, Production,
218 Government, Kermanshah, Production,
219 Government, Abadan, Production,
220 Government, Zarghan, Production,
Product, Amount(t), Year lon lat
216 Crude.Petroleum.Natural.Gas, 209800000 2008 56.26665 27.18322
217 Crude.Petroleum.Natural.Gas, 209800000 2008 51.66597 32.65390
218 Crude.Petroleum.Natural.Gas, 209800000 2008 47.07777 34.32769
219 Crude.Petroleum.Natural.Gas, 209800000 2008 48.29340 30.34730
220 Crude.Petroleum.Natural.Gas, 209800000 2008 52.71349 29.76416
Iran <- getData('GADM', country = 'IRN', level=1)
Iran <- fortify(Iran, region = "NAME_1")
h <- ggplot() +
geom_map(data=NewOil2_2008, aes(NewOil2_2008$`Location,`, fill = NewOil2_2008$`Amount(t),`), map=Iran) +
ylim(c(20,41)) + xlim(c(44,65)) + theme_void() +
labs(fill = "Number of events")
我希望我的数据集中有五个省份的伊朗的氯百分数以变量NewOil2_2008 $ Amount(t),
的比例突出显示。但是,现在出现错误警告“忽略未知的美学:x”。有人知道如何解决这个问题吗?