This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
## Load the library
library(dplyr)
library(maps)
library(reshape2)
library(leaflet)
library(gridExtra)
library(htmlwidgets)
library(leaflet.extras)
package 㤼㸱leaflet.extras㤼㸲 was built under R version 3.3.3
library(magrittr)
package 㤼㸱magrittr㤼㸲 was built under R version 3.3.2
Attaching package: 㤼㸱magrittr㤼㸲
The following object is masked from 㤼㸱package:ggmap㤼㸲:
inset
testDatav2 <- m1test
MapDisplay <- leaflet() %>%
addProviderTiles(providers$CartoDB.Positron)
popupInfo <- paste(testDatav2[['ContractRef']],
", ",
testDatav2[['LoanBalance']],
"<br>",
"Average January Temp in F: ",
testDatav2[['DefaultedLoans']],
"<br>",
"Credit Rating: ",
testDatav2[['CreditRating']],
"<br>",
"LTV: ",
testDatav2[['LTV']],
"<br>",
"Property Value: ",
testDatav2[['PropertyValue']],
sep='')
purrr::walk(
testDatav2$DefaultedLoans,
function(DefaultedLoans) {
MapDisplay <<- MapDisplay %>%
addHeatmap(
data = testDatav2,
layerId = testDatav2$DefaultedLoans, group = testDatav2$DefaultedLoans,
lng=~AddressLongitude, lat=~AddressLatitude,
blur = 20, max = 0.05, radius = 15)
})
Error: cannot allocate vector of size 170 Kb
Map
library(dplyr)
library(maps)
library(reshape2)
library(leaflet)
library(gridExtra)
library(htmlwidgets)
library(leaflet.extras)
library(magrittr)
testDatav2 <- m1test
leaf <- leaflet() %>%
addProviderTiles(providers$CartoDB.Positron)
leaf %>%
setView(-6.24420, 53.30867, 12) %>%
addLayersControl(
baseGroups = testDatav2$DefaultedLoans,
options = layersControlOptions(collapsed = FALSE)
)%>%
addHeatmap(
data = testDatav2[['CreditRating']],
layerId = testDatav2$CreditRating, group = testDatav2$CreditRating,
lng=testDatav2$AddressLongitude, lat=testDatav2$AddressLatitude,
blur = 20, max = 0.05, radius = 15)
LS0tDQp0aXRsZTogIlIgTm90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W4gRjogICIsDQogICAgICAgICAgICAgICAgICAgdGVzdERhdGF2MltbJ0RlZmF1bHRlZExvYW5zJ11dLA0KICAgICAgICAgICAgICAgICAgICI8YnI+IiwgDQogICAgICAgICAgICAgICAgICAgIkNyZWRpdCBSYXRpbmc6ICAiLA0KICAgICAgICAgICAgICAgICAgIHRlc3REYXRhdjJbWydDcmVkaXRSYXRpbmcnXV0sDQogICAgICAgICAgICAgICAgICAgIjxicj4iLCANCiAgICAgICAgICAgICAgICAgICAiTFRWOiAgIiwNCiAgICAgICAgICAgICAgICAgICB0ZXN0RGF0YXYyW1snTFRWJ11dLA0KICAgICAgICAgICAgICAgICAgICI8YnI+IiwgDQogICAgICAgICAgICAgICAgICAgIlByb3BlcnR5IFZhbHVlOiAgIiwNCiAgICAgICAgICAgICAgICAgICB0ZXN0RGF0YXYyW1snUHJvcGVydHlWYWx1ZSddXSwNCiAgICAgICAgICAgICAgICAgICBzZXA9JycpDQoNCg0KTWFwRGlzcGxheSA8LSBsZWFmbGV0KHRlc3REYXRhdjIpICU+JSANCiAgc2V0VmlldygtNi4yNDQyMCwgNTMuMzA4NjcsIHpvb20gPSAxMikgJT4lDQogIGFkZExheWVyc0NvbnRyb2woYmFzZUdyb3VwcyA9IHRlc3REYXRhdjIkQ3JlZGl0UmF0aW5nLA0KICAgIG9wdGlvbnMgPSBsYXllcnNDb250cm9sT3B0aW9ucyhjb2xsYXBzZWQgPSBGQUxTRSkpDQojJT4lDQogIyBhZGRIZWF0bWFwKGxuZyA9IH5BZGRyZXNzTG9uZ2l0dWRlLCBsYXQgPSB+QWRkcmVzc0xhdGl0dWRlLCBpbnRlbnNpdHkgPSB+TG9hbkJhbGFuY2UsDQogICMgICAgICAgICAgIGJsdXIgPSAyMCwgbWF4ID0gMC4wNSwgcmFkaXVzID0gMjAsbGF5ZXJJZCA9IHRlc3REYXRhdjIkQ3JlZGl0UmF0aW5nLCBncm91cCA9IHRlc3REYXRhdjIkQ3JlZGl0UmF0aW5nKQ0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