R 传单,错误:无法分配大小为177.2 Mb的向量

R 传单,错误:无法分配大小为177.2 Mb的向量,r,memory,leaflet,R,Memory,Leaflet,我已经尝试了所有我能想到的方法来修复这个错误,但是我还没有找到答案。32位机器,试图构建一个choropleth。该数据文件非常基本,有些城市ID带有与之相关的人口数据。形状文件取自以下位置:www.antional.ca/data/civility-bounders library('tmap') library('leaflet') library('magrittr') library('rio') library('plyr') library('scales') library('ht

我已经尝试了所有我能想到的方法来修复这个错误,但是我还没有找到答案。32位机器,试图构建一个choropleth。该数据文件非常基本,有些城市ID带有与之相关的人口数据。形状文件取自以下位置:www.antional.ca/data/civility-bounders

library('tmap')
library('leaflet')
library('magrittr')
library('rio')
library('plyr')
library('scales')
library('htmlwidgets')
library('tmaptools')
setwd("C:/Users/rdhasa/desktop")
datafile <- "shapefiles2/Population - 2014.csv"
Pop2014 <- rio::import(datafile)
Pop2014$Population <- as.factor(Pop2014$Population)
str(Pop2014)
library('tmap')
图书馆(“传单”)
图书馆(“magrittr”)
图书馆(“里约”)
图书馆(“plyr”)
库('比例')
库('htmlwidgets')
库('tmaptools')
setwd(“C:/Users/rdhasa/desktop”)

数据文件我建议在尝试修复错误时包括您迄今为止尝试过的内容,并且我会尽量避免在帖子中转储大量文本,除非所有这些都是绝对必要的。欢迎使用!如果您在使用R时遇到此问题,您至少应该在问题标签中添加此语言。
mnshape <- "shapefiles2/MUNICIPAL_BOUNDARY_LOWER_AND_SINGLE_TIER.shp"
mngeo2 <- read_shape(file=mnshape)
str(mngeo2@data)
mnmap <- append_data(mngeo2, Pop2014, key.shp = "MUNID", key.data="MUNID")
minPct <- min(c(mnmap@data$Population))
maxPct <- max(c(mnmap@data$Population))
paletteLayers <- colorBin(palette = "RdBu", domain = c(minPct, maxPct), bins = c(0, 50000,200000 ,500000, 1000000, 2000000) , pretty=FALSE)
rm(mngeo2)
rm(Pop2014)
rm(mnshape)
rm(datafile)
rm(maxPct)
rm(minPct)
gc()
leaflet(mnmap) %>%
  addProviderTiles("CartoDB.Positron") %>%
  addPolygons(stroke=TRUE, 
              smoothFactor = 0.2,
              weight = 1,
              fillOpacity = .6)