/*******************************************************************************************************************
-- Title : [R3.3] ggmap을 이용하여 지도 불러오기
-- Reference : http://m.blog.naver.com/goldenezkang/220053464515
-- Key word : R ggmap googlemap get_map get_googlemap ggmap ggplot2 구글맵 지도
*******************************************************************************************************************/
-- Chart
-- R Script
# ***********************************************
# -- ggmap을 이용하여 지도 불러오기
# ***********************************************
if (!('ggplot2' %in% rownames(installed.packages()))){
install.packages('ggplot2')
}
if (!('ggmap' %in% rownames(installed.packages()))){
install.packages('ggmap')
}
library(ggplot2)
library(ggmap)
seoul <- get_map("Seoul, South Korea", zoom=13, maptype = "roadmap")
ggmap(seoul)
?get_map
# ***********************************************
# -- 샘플데이터 생성과 육면체그래프
# ***********************************************
if (!('hexbin' %in% rownames(installed.packages()))){
install.packages('hexbin')
}
library(hexbin)
Lon <- rnorm(5000, 126.950, 0.01)
Lon <- c(Lon, rnorm(5000, 127, 0.008))
Lat <- rnorm(5000,37.56,0.01)
Lat <- c(Lat, rnorm(5000, 37.57, 0.005))
Loc <- data.frame(Lon, Lat)
Loc
ggplot(Loc, aes(x=Lon, y=Lat)) + geom_hex(binwidth=c(0.1/12,0.08/12), alpha = 0.3)