我使用RStudio v0.99.902中的以下代码在传单中创建圆圈地图:
library(leaflet)
map <- leaflet(data) %>%
addTiles() %>% setView(-77.4,40.1,6) %>%
addCircles(~data$INTPTLON,data$INTPTLAT,radius=(54),runif(90, -2, -1), runif(90, 53, 54), runif(90, 10, 500))
map
这是我的数据:
structure(list(zipcode = numeric(0), Group.1 = structure(integer(0), .Label = c("09:52:08AM",
"11222", "15025", "15062", "15101", "15104", "15108", "15132",
"15136", "15143", "15145", "15201", "15203", "15210", "15212",
"15213", "15215", "15216", "15221", "15222", "15228", "15235",
"15423", "15459", "15561", "15642", "15644", "15681", "15697",
"15701", "15717", "15728", "15748", "15920", "15931", "16101",
"16105", "16151", "16201", "16335", "16365", "16412", "16501",
"16503", "16505", "16507", "16509", "16801", "16875", "17025",
"17033", "17042", "17068", "17255", "17315", "17317", "17325",
"17347", "17356", "17403", "17522", "17543", "17601", "17602",
"17603", "17754", "17837", "17951", "18040", "18102", "18109",
"18229", "18232", "18431", "18505", "18512", "18634", "18702",
"18944", "19014", "19020", "19063", "19072", "19086", "19102",
"19103", "19104", "19106", "19107", "19111", "19116", "19118",
"19121", "19124", "19125", "19131", "19132", "19139", "19140",
"19141", "19142", "19143", "19144", "19145", "19146", "19148",
"19151", "19401", "19403", "19438", "19464", "19522", "19533",
"19604"), class = "factor"), jobScr = numeric(0), ProgD1 = numeric(0),
ad51 = numeric(0), ad52 = numeric(0), ad53 = numeric(0),
ad54 = numeric(0), ad55 = numeric(0), ad56 = numeric(0),
ad57 = numeric(0), ProgD5 = numeric(0), ProgD6 = numeric(0),
ProgD7 = numeric(0), ProgD8 = numeric(0), ad9a = numeric(0),
ad9b = numeric(0), ad9c = numeric(0), ad9d = numeric(0),
Q02_Eff1 = numeric(0), Q03_Eff2 = numeric(0), Q04_Eff3 = numeric(0),
Q05_Eff4 = numeric(0), Q06_Eff5 = numeric(0), Q07_Eff6 = numeric(0),
Q08_Eff7 = numeric(0), Q09_Eff8 = numeric(0), Q10_Eff9 = numeric(0),
Q11_Eff10 = numeric(0), Q12_Eff11 = numeric(0), Q13_Eff12 = numeric(0),
ds22 = numeric(0), Academic = numeric(0), STEMfld = numeric(0),
STEMfld2 = numeric(0), sex = numeric(0), occupation = numeric(0),
Other12 = numeric(0), ageRange = numeric(0), STEMfld3 = numeric(0),
Time = numeric(0), Date = numeric(0), Duration = numeric(0),
CLASSFP = structure(integer(0), .Label = "B5", class = "factor"),
MTFCC = structure(integer(0), .Label = "G6350", class = "factor"),
FUNCSTAT = structure(integer(0), .Label = "S", class = "factor"),
ALAND = integer(0), AWATER = integer(0), INTPTLAT = numeric(0),
INTPTLON = numeric(0)), .Names = c("zipcode", "Group.1",
"jobScr", "ProgD1", "ad51", "ad52", "ad53", "ad54", "ad55", "ad56",
"ad57", "ProgD5", "ProgD6", "ProgD7", "ProgD8", "ad9a", "ad9b",
"ad9c", "ad9d", "Q02_Eff1", "Q03_Eff2", "Q04_Eff3", "Q05_Eff4",
"Q06_Eff5", "Q07_Eff6", "Q08_Eff7", "Q09_Eff8", "Q10_Eff9", "Q11_Eff10",
"Q12_Eff11", "Q13_Eff12", "ds22", "Academic", "STEMfld", "STEMfld2",
"sex", "occupation", "Other12", "ageRange", "STEMfld3", "Time",
"Date", "Duration", "CLASSFP", "MTFCC", "FUNCSTAT", "ALAND",
"AWATER", "INTPTLAT", "INTPTLON"), row.names = integer(0), class = "data.frame")
leaflet map of circles in Penna. 代码在控制台/查看器中生成精美的地图,但是,当我将代码放在Rmarkdown中时,背景地图可以工作但DOTS DISAPPEAR。没有错误或警告。任何想法如何解决?