R Programming/R을 이용한 누구나 하는 통계분석

R을 이용한 지도차트 그리기 R코드

루치아 (Lucia) 2015. 10. 1. 11:36
반응형

install.packages("ggplot2")

install.packages("ggmap")

library(ggmap)

library(ggplot2)

setwd("d:/data")

wifizone<-read.csv("wifizone.csv",encoding = "EUC-KR") #한글이 있어서 인코딩

cent<-c(mean(wifizone$LON),mean(wifizone$LAT))

gc<-geocode("seoul,korea",source="google")

center<-as.numeric(gc)

center

bmap<-ggmap(get_googlemap(center=cent,zoom=11),extent="device",base_layer=ggplot(wifizone,aes(x=LON,y=LAT,colour=FLY_GBN)))

bmap+geom_point()

bmap+geom_density2d()+facet_wrap(~FLY_GBN)

반응형