1 서울 인구수

library(readxl)
pop <- read_excel("stndata.xlsx")
pop <- subset(pop, cd_Do==11)
pop$address <- do.call(c, lapply(stringr::str_split(pop$address, " "), "[[", 2))
# 구 위/경도 센터 추출
#c_lat <- aggregate(latitude~address, data=pop, mean)
#c_lon <- aggregate(longitude~address,data=pop, mean)
#centers_s <- merge(c_lat, c_lon, by="address")
# 구별 인구수
total_ppln <- aggregate(total_ppln~address+cd_si_gu+cd_dong, data=pop, mean)
total_ppln <- aggregate(total_ppln~address+cd_si_gu, data=total_ppln, sum)
# 
# 구별 남자인구수
male_ppln <- aggregate(male_ppln~address+cd_si_gu+cd_dong, data=pop, mean)
male_ppln <- aggregate(male_ppln~address, data=male_ppln, sum)
n_pop <- merge(male_ppln, total_ppln, by="address")
centers_s <- merge(centers_s, n_pop, by="address")


oid <- order(centers_s$cd_si_gu)
centers_s <- centers_s[oid, ]
load("seoul_map_2.RData")
centers_s

2 구글 지도위에 그리기