I am trying to make a heat map of the US with a very large data set and I am getting this error.
Error: cannot allocate vector of size 140.7 Mb
I know my data set might be to big, I am looking for options to keep the integrity of my data and still make my heat map.
This is what iv done so far.
ditch_the_axes <- theme(
axis.text = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
panel.border = element_blank(),
panel.grid = element_blank(),
axis.title = element_blank()
)
MapKickstarter %>% ggplot( mapping = aes(x = long, y = lat, group = group)) +
geom_polygon( aes(fill = sqrt(pledgedUSD)), color = "white") +
geom_polygon(color = "black", fill = NA) +
theme_bw() + ditch_the_axes +
scale_fill_gradientn(colours = rev(rainbow(7)))
I used the maps package to get the polyogons of the US states and then merged with a data set of 97000 observations. This then gave me a data set of 36 million observations. This could could be the root of my problems but im wanted both polygon data and my other data set.
Polygon data set using maps package:
states <- map_data('state')
Merging my data set:
MapKickstarter <- inner_join(MapKickstarter,states, by = "State")