Chapter 9 부동산 정보 데이터 처리 및 시각화
9.1 공공데이터 포털 가입 하고 API 키 얻기
데이터는 파일, 데이터베이스, 인터넷 등 다양한 경로를 통해 수집 할 수 있습니다. 기업의 많은 데이터를 분석위해 공공기관에서 제공 하는 데이터와 조합하여 분석하는 경우가 많습니다. 우리 나라는 세계에서 손꼽을 정도로 공공 데이터 공개가 고도로 발달되어 있습니다. 공공데이터를 어덯게 가져 오기 위해서는 공공 데이터 포털에 가입해야 합니다.
9.1.1 회원 가입
9.1.2 일반회원으로 가입
9.1.3 회원가입을 위한 정보 입력
9.1.4 이용약관 동의
9.1.5 정보입력
9.1.6 회원가입 완료
9.1.7 “국토부 실거래가”" 로 API 검색
9.1.8 “아파트매매 실거래 상세 자료” -> 활용신청
9.1.9 활용신청 상세
9.1.10 신청현황 / 결과
9.1.11 API 정보 확인
9.2 API를 이용해 국토부 아파트매매 실거래가 가져오기
install.packages("triebeard")
install.packages("urltools")
install.packages("httr")
install.packages("jsonlite")
## Warning: package 'httr' was built under R version 4.0.2
## Warning: package 'urltools' was built under R version 4.0.2
## Warning: package 'jsonlite' was built under R version 4.0.2
##
## Attaching package: 'jsonlite'
## The following object is masked from 'package:purrr':
##
## flatten
## Warning: package 'triebeard' was built under R version 4.0.2
- 호출 URL 및 제공받은 API 를 입력 합니다.
path <- "http://openapi.molit.go.kr/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTradeDev?"
key <- "<공공 데이터 포털에서 받은 키를 입력 하세요>"
- URLencode 함수는 URL 방식을 이용하여 데이터를 전송하고자 할때 URL 양식으로 데이터를 변환 해줍니다.
httr 패키지의 GET 함수를 이용해서 *아파트 실거래가 조회" API를 호출 합니다.
호출 할때 API 에서 요구하는 법정동코드, 거래월, 서비스키, 조회목록 개수 를 입력 합니다.
상세한 호출 정보는 API 문서에 있고, 샘플 코드도 있습니다.
- 개발 가이드
- 개발 가이드 내용 중 입력 파라메터 부분
- 개발 가이드 내의 샘플 코드
- GET 함수에 입력값을 이용해 API를 호출 합니다.
request <- paste(path,
"LAWD_CD","=",11710,"&",
"DEAL_YMD","=",201904,"&",
"serviceKey","=",service_key,
sep="")
response <- GET(request)
#response <- GET(url = path,
# query = list(LAWD_CD ="11710", DEAL_YMD="201804",
# serviceKey=service_key, numOfRows="100")
# )
- 응답 결과를 검사 합니다.
- 응답 결과를 보면 Size 가 61.6kb 의 json 문서가 포함되어 있습니다.
## Response [http://openapi.molit.go.kr/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTradeDev?LAWD_CD=11710&DEAL_YMD=201904&serviceKey=%2F9qD%2FPbjCfTTM33R%2FzWiOuX5MBKgkrrwi62FHsQx%2B5YlpUFzvtVuxH8ehLKhuFzf53TQvU6OYF2SGI2Mx9SwHA%3D%3D]
## Date: 2021-01-06 13:57
## Status: 200
## Content-Type: application/json
## Size: 6.25 kB
## $category
## [1] "Success"
##
## $reason
## [1] "OK"
##
## $message
## [1] "Success: (200) OK"
- 응답받은 결과를 UTF-8 로 인코딩 하고 JSON 에서 R개체로 변환 합니다.
- fromJSON 함수는 json 양식을 R 객체로 바꿔줍니다.
- res 의 속성을 확인해보니 List 입니다. 이제 리스트를 부석을 위해 데이터 프레임으로 바꿔야 합니다.
- 출력 결과를 보면 List 구조 안에 items 라는 데이터프레임이 들어 있습니다.
## List of 1
## $ response:List of 2
## ..$ header:List of 2
## .. ..$ resultCode: chr "00"
## .. ..$ resultMsg : chr "NORMAL SERVICE."
## ..$ body :List of 4
## .. ..$ items :List of 1
## .. .. ..$ item:'data.frame': 10 obs. of 24 variables:
## .. .. .. ..$ 거래금액 : chr [1:10] " 185,000" " 74,000" " 150,000" " 168,000" ...
## .. .. .. ..$ 건축년도 : int [1:10] 2006 2008 2007 2005 2008 2005 2008 2007 2005 2007
## .. .. .. ..$ 년 : int [1:10] 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019
## .. .. .. ..$ 도로명 : chr [1:10] "잠실로" "올림픽로" "잠실로" "올림픽로" ...
## .. .. .. ..$ 도로명건물본번호코드: chr [1:10] "00088" "00135" "00062" "00212" ...
## .. .. .. ..$ 도로명건물부번호코드: chr [1:10] "00000" "00000" "00000" "00000" ...
## .. .. .. ..$ 도로명시군구코드 : int [1:10] 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## .. .. .. ..$ 도로명일련번호코드 : chr [1:10] "01" "01" "01" "01" ...
## .. .. .. ..$ 도로명지상지하코드 : int [1:10] 0 0 0 0 0 0 0 0 0 0
## .. .. .. ..$ 도로명코드 : int [1:10] 3123015 3123023 3123015 3123023 3123023 3123023 3123023 3123015 3123023 3123015
## .. .. .. ..$ 법정동 : chr [1:10] " 잠실동" " 잠실동" " 잠실동" " 잠실동" ...
## .. .. .. ..$ 법정동본번코드 : chr [1:10] "0044" "0022" "0035" "0040" ...
## .. .. .. ..$ 법정동부번코드 : chr [1:10] "0000" "0000" "0000" "0000" ...
## .. .. .. ..$ 법정동시군구코드 : int [1:10] 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## .. .. .. ..$ 법정동읍면동코드 : int [1:10] 10100 10100 10100 10100 10100 10100 10100 10100 10100 10100
## .. .. .. ..$ 법정동지번코드 : int [1:10] 1 1 1 1 1 1 1 1 1 1
## .. .. .. ..$ 아파트 : chr [1:10] "레이크팰리스" "리센츠" "트리지움" "갤러리아팰리스" ...
## .. .. .. ..$ 월 : int [1:10] 4 4 4 4 4 4 4 4 4 4
## .. .. .. ..$ 일 : int [1:10] 3 3 3 4 4 5 5 5 6 6
## .. .. .. ..$ 일련번호 : chr [1:10] "11710-5957" "11710-6249" "11710-6028" "11710-281" ...
## .. .. .. ..$ 전용면적 : num [1:10] 135.8 27.7 84.8 151.2 84.8 ...
## .. .. .. ..$ 지번 : int [1:10] 44 22 35 40 19 40 19 35 40 35
## .. .. .. ..$ 지역코드 : int [1:10] 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## .. .. .. ..$ 층 : int [1:10] 21 19 29 36 30 4 10 21 18 1
## .. ..$ numOfRows : int 10
## .. ..$ pageNo : int 1
## .. ..$ totalCount: int 284
- 리스트 구조를 잘 살펴서 우리가 원하는 정보의 위치를 찾아 출력해봅니다.
## 'data.frame': 10 obs. of 24 variables:
## $ 거래금액 : chr " 185,000" " 74,000" " 150,000" " 168,000" ...
## $ 건축년도 : int 2006 2008 2007 2005 2008 2005 2008 2007 2005 2007
## $ 년 : int 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019
## $ 도로명 : chr "잠실로" "올림픽로" "잠실로" "올림픽로" ...
## $ 도로명건물본번호코드: chr "00088" "00135" "00062" "00212" ...
## $ 도로명건물부번호코드: chr "00000" "00000" "00000" "00000" ...
## $ 도로명시군구코드 : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## $ 도로명일련번호코드 : chr "01" "01" "01" "01" ...
## $ 도로명지상지하코드 : int 0 0 0 0 0 0 0 0 0 0
## $ 도로명코드 : int 3123015 3123023 3123015 3123023 3123023 3123023 3123023 3123015 3123023 3123015
## $ 법정동 : chr " 잠실동" " 잠실동" " 잠실동" " 잠실동" ...
## $ 법정동본번코드 : chr "0044" "0022" "0035" "0040" ...
## $ 법정동부번코드 : chr "0000" "0000" "0000" "0000" ...
## $ 법정동시군구코드 : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## $ 법정동읍면동코드 : int 10100 10100 10100 10100 10100 10100 10100 10100 10100 10100
## $ 법정동지번코드 : int 1 1 1 1 1 1 1 1 1 1
## $ 아파트 : chr "레이크팰리스" "리센츠" "트리지움" "갤러리아팰리스" ...
## $ 월 : int 4 4 4 4 4 4 4 4 4 4
## $ 일 : int 3 3 3 4 4 5 5 5 6 6
## $ 일련번호 : chr "11710-5957" "11710-6249" "11710-6028" "11710-281" ...
## $ 전용면적 : num 135.8 27.7 84.8 151.2 84.8 ...
## $ 지번 : int 44 22 35 40 19 40 19 35 40 35
## $ 지역코드 : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## $ 층 : int 21 19 29 36 30 4 10 21 18 1
- items 라는 데이터 프레임만 꺼내서 apt 에 저장합니다.
## 'data.frame': 10 obs. of 24 variables:
## $ 거래금액 : chr " 185,000" " 74,000" " 150,000" " 168,000" ...
## $ 건축년도 : int 2006 2008 2007 2005 2008 2005 2008 2007 2005 2007
## $ 년 : int 2019 2019 2019 2019 2019 2019 2019 2019 2019 2019
## $ 도로명 : chr "잠실로" "올림픽로" "잠실로" "올림픽로" ...
## $ 도로명건물본번호코드: chr "00088" "00135" "00062" "00212" ...
## $ 도로명건물부번호코드: chr "00000" "00000" "00000" "00000" ...
## $ 도로명시군구코드 : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## $ 도로명일련번호코드 : chr "01" "01" "01" "01" ...
## $ 도로명지상지하코드 : int 0 0 0 0 0 0 0 0 0 0
## $ 도로명코드 : int 3123015 3123023 3123015 3123023 3123023 3123023 3123023 3123015 3123023 3123015
## $ 법정동 : chr " 잠실동" " 잠실동" " 잠실동" " 잠실동" ...
## $ 법정동본번코드 : chr "0044" "0022" "0035" "0040" ...
## $ 법정동부번코드 : chr "0000" "0000" "0000" "0000" ...
## $ 법정동시군구코드 : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## $ 법정동읍면동코드 : int 10100 10100 10100 10100 10100 10100 10100 10100 10100 10100
## $ 법정동지번코드 : int 1 1 1 1 1 1 1 1 1 1
## $ 아파트 : chr "레이크팰리스" "리센츠" "트리지움" "갤러리아팰리스" ...
## $ 월 : int 4 4 4 4 4 4 4 4 4 4
## $ 일 : int 3 3 3 4 4 5 5 5 6 6
## $ 일련번호 : chr "11710-5957" "11710-6249" "11710-6028" "11710-281" ...
## $ 전용면적 : num 135.8 27.7 84.8 151.2 84.8 ...
## $ 지번 : int 44 22 35 40 19 40 19 35 40 35
## $ 지역코드 : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710
## $ 층 : int 21 19 29 36 30 4 10 21 18 1
- apt 데이터 프레임의 컬럼 이름들을 확인 해봅니다.
## [1] "거래금액" "건축년도" "년"
## [4] "도로명" "도로명건물본번호코드" "도로명건물부번호코드"
## [7] "도로명시군구코드" "도로명일련번호코드" "도로명지상지하코드"
## [10] "도로명코드" "법정동" "법정동본번코드"
## [13] "법정동부번코드" "법정동시군구코드" "법정동읍면동코드"
## [16] "법정동지번코드" "아파트" "월"
## [19] "일" "일련번호" "전용면적"
## [22] "지번" "지역코드" "층"
## chr [1:24] "거래금액" "건축년도" "년" "도로명" "도로명건물본번호코드" ...
- 분석을 위해 필요한 라이브러리를 로드합니다.
- 컬럼명들을 영문으로 변경 합니다.
colnames(apt) <- c("price", "build_year", "year", "road_name", "bon", "bu", "gungu", "serial", "gr_code",
"road_code", "bgd","bgd_bon", "bgd_bu","bgd_sigungu","bgd_emd", "bgd_gibun","apt_name", "month", "day", "serial2", "size", "gibun", "area_code", "floor")
- 아파트 가격에 ‘,’ 가 들어가 있어 연산이 불가능 합니다. ‘,’ 을 제거 하겠습니다.
## # A tibble: 10 x 24
## price build_year year road_name bon bu gungu serial gr_code road_code
## <chr> <int> <int> <chr> <chr> <chr> <int> <chr> <int> <int>
## 1 " … 2006 2019 잠실로 00088 00000 11710 01 0 3123015
## 2 " … 2008 2019 올림픽로 00135 00000 11710 01 0 3123023
## 3 " … 2007 2019 잠실로 00062 00000 11710 01 0 3123015
## 4 " … 2005 2019 올림픽로 00212 00000 11710 01 0 3123023
## 5 " … 2008 2019 올림픽로 00099 00000 11710 01 0 3123023
## 6 " … 2005 2019 올림픽로 00212 00000 11710 01 0 3123023
## 7 " … 2008 2019 올림픽로 00099 00000 11710 01 0 3123023
## 8 " … 2007 2019 잠실로 00062 00000 11710 01 0 3123015
## 9 " … 2005 2019 올림픽로 00212 00000 11710 01 0 3123023
## 10 " … 2007 2019 잠실로 00062 00000 11710 01 0 3123015
## # … with 14 more variables: bgd <chr>, bgd_bon <chr>, bgd_bu <chr>,
## # bgd_sigungu <int>, bgd_emd <int>, bgd_gibun <int>, apt_name <chr>,
## # month <int>, day <int>, serial2 <chr>, size <dbl>, gibun <int>,
## # area_code <int>, floor <int>
## price build_year year road_name bon bu gungu serial gr_code road_code
## 1 185000 2006 2019 잠실로 00088 00000 11710 01 0 3123015
## 2 74000 2008 2019 올림픽로 00135 00000 11710 01 0 3123023
## 3 150000 2007 2019 잠실로 00062 00000 11710 01 0 3123015
## bgd bgd_bon bgd_bu bgd_sigungu bgd_emd bgd_gibun apt_name month day
## 1 잠실동 0044 0000 11710 10100 1 레이크팰리스 4 3
## 2 잠실동 0022 0000 11710 10100 1 리센츠 4 3
## 3 잠실동 0035 0000 11710 10100 1 트리지움 4 3
## serial2 size gibun area_code floor
## 1 11710-5957 135.82 44 11710 21
## 2 11710-6249 27.68 22 11710 19
## 3 11710-6028 84.83 35 11710 29
- 평당 가격 컬럼을 새로 생성 합니다.
- 1평은 3.3 제곱 미터 이기 때문에 평당가격 = 매매가 / (크기 / 3.3)
## price build_year year road_name bon bu gungu serial gr_code road_code
## 1 185000 2006 2019 잠실로 00088 00000 11710 01 0 3123015
## 2 74000 2008 2019 올림픽로 00135 00000 11710 01 0 3123023
## 3 150000 2007 2019 잠실로 00062 00000 11710 01 0 3123015
## bgd bgd_bon bgd_bu bgd_sigungu bgd_emd bgd_gibun apt_name month day
## 1 잠실동 0044 0000 11710 10100 1 레이크팰리스 4 3
## 2 잠실동 0022 0000 11710 10100 1 리센츠 4 3
## 3 잠실동 0035 0000 11710 10100 1 트리지움 4 3
## serial2 size gibun area_code floor price_by_area
## 1 11710-5957 135.82 44 11710 21 4494.920
## 2 11710-6249 27.68 22 11710 19 8822.254
## 3 11710-6028 84.83 35 11710 29 5835.200
- 아파트 이름과 도로명 주소는 utf-8 로 인코딩 하여 다시 저장합니다.
apt$road_name = utf8::utf8_encode(apt$road_name)
apt$apt_name = utf8::utf8_encode(apt$apt_name)
# 맥에서 폰트가 없을경우 한글이 깨집니다. 맥에 있는 폰트로 지정 하면 됩니다.
theme_set(theme_gray(base_family="AppleGothic"))
ggplot(data=apt, mapping = aes(x=build_year, y=price_by_area)) +
geom_point(mapping = aes(color=apt_name)) +
geom_smooth() +
theme(legend.position = "bottom")
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 2005
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 2.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 4.0602
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used at
## 2005
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 2.015
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal condition
## number 0
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other near
## singularities as well. 4.0602
- 건축 년도가 오래 될수록 아파트 평당 가격은 어떨까요?
## price build_year year road_name bon bu gungu serial gr_code road_code
## 1 185000 2006 2019 잠실로 00088 00000 11710 01 0 3123015
## 2 74000 2008 2019 올림픽로 00135 00000 11710 01 0 3123023
## 3 150000 2007 2019 잠실로 00062 00000 11710 01 0 3123015
## 4 168000 2005 2019 올림픽로 00212 00000 11710 01 0 3123023
## 5 162000 2008 2019 올림픽로 00099 00000 11710 01 0 3123023
## bgd bgd_bon bgd_bu bgd_sigungu bgd_emd bgd_gibun apt_name month day
## 1 잠실동 0044 0000 11710 10100 1 레이크팰리스 4 3
## 2 잠실동 0022 0000 11710 10100 1 리센츠 4 3
## 3 잠실동 0035 0000 11710 10100 1 트리지움 4 3
## 4 잠실동 0040 0000 11710 10100 1 갤러리아팰리스 4 4
## 5 잠실동 0019 0000 11710 10100 1 잠실엘스 4 4
## serial2 size gibun area_code floor price_by_area
## 1 11710-5957 135.820 44 11710 21 4494.920
## 2 11710-6249 27.680 22 11710 19 8822.254
## 3 11710-6028 84.830 35 11710 29 5835.200
## 4 11710-281 151.189 40 11710 36 3666.933
## 5 11710-6346 84.800 19 11710 30 6304.245
by_apt_name <- group_by(apt, apt_name, build_year)
apt2 <- summarise(by_apt_name, mean_apt_price_by_size = mean(price_by_area, na.rm = TRUE))
## `summarise()` regrouping output by 'apt_name' (override with `.groups` argument)
## # A tibble: 5 x 3
## # Groups: apt_name [5]
## apt_name build_year mean_apt_price_by_size
## <chr> <int> <dbl>
## 1 갤러리아팰리스 2005 3643.
## 2 레이크팰리스 2006 4495.
## 3 리센츠 2008 8822.
## 4 잠실엘스 2008 6204.
## 5 트리지움 2007 6154.
ggplot(data = apt2, mapping = aes(x = reorder(apt_name, build_year), y =mean_apt_price_by_size )) +
geom_bar(stat = "identity",mapping = aes(fill = build_year)) +
theme(axis.text.x=element_text(angle =90, vjust = 0.5))
9.2.1 전체 코드
library('httr')
library('urltools')
library('jsonlite')
library('ggplot2')
library("tidyverse")
path <- "http://openapi.molit.go.kr/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTradeDev?"
key <- "%2F9qD%2FPbjCfTTM33R%2FzWiOuX5MBKgkrrwi62FHsQx%2B5YlpUFzvtVuxH8ehLKhuFzf53TQvU6OYF2SGI2Mx9SwHA%3D%3D"
service_key <- utf8::utf8_encode(URLencode(key))
request <- paste(path,
"LAWD_CD","=",11710,"&",
"DEAL_YMD","=",201904,"&",
"serviceKey","=",service_key,
sep="")
response <- GET(request)
http_status(response)
content <- content(response, "text",encoding = "UTF-8")
res <- fromJSON(content)
str(res$response$body$items$item)
apt = res$response$body$items$item
str(apt)
colnames(apt)
colnames(apt) <- c("price", "build_year", "year", "road_name", "bon", "bu", "gungu", "serial", "gr_code",
"road_code", "bgd","bgd_bon", "bgd_bu","bgd_sigungu","bgd_emd", "bgd_gibun","apt_name", "month", "day", "serial2", "size", "gibun", "area_code", "floor")
as_tibble(apt)
apt$price <- as.numeric(gsub('[$,]', '', apt$price))
apt <- mutate(apt, price_by_area = apt$price / (size / 3.3))
apt$road_name = utf8::utf8_encode(apt$road_name)
apt$apt_name = utf8::utf8_encode(apt$apt_name)
# 데이터셋 저장
write_rds(apt, path="apt.rds")
theme_set(theme_gray(base_family="AppleGothic"))
ggplot(data=apt, mapping = aes(x=build_year, y=price_by_area)) +
geom_point(mapping = aes(color=apt_name)) +
geom_smooth() +
theme(legend.position = "bottom")
by_apt_name <- group_by(apt, apt_name, build_year)
apt2 <- summarise(by_apt_name, mean_apt_price_by_size = mean(price_by_area, na.rm = TRUE))
apt2
ggplot(data = apt2, mapping = aes(x = reorder(apt_name, build_year), y =mean_apt_price_by_size )) +
geom_bar(stat = "identity",mapping = aes(fill = build_year)) +
theme(axis.text.x=element_text(angle =90, vjust = 0.5))
9.3 shiny
shiny 라이브러리 이용해서 동적 그래프를 생성할 수 있습니다.
## Warning: package 'shiny' was built under R version 4.0.2
##
## Attaching package: 'shiny'
## The following object is masked from 'package:jsonlite':
##
## validate
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## datetime = col_datetime(format = ""),
## season = col_double(),
## holiday = col_double(),
## workingday = col_double(),
## weather = col_double(),
## temp = col_double(),
## atemp = col_double(),
## humidity = col_double(),
## windspeed = col_double(),
## casual = col_double(),
## registered = col_double(),
## count = col_double()
## )
bike_add_time <- bike %>% mutate(hour = format(datetime, "%H"))
datetime_info <- bike_add_time %>% distinct(hour) %>% arrange(hour) %>% select(hour)
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
selectInput("dataSelect"," :", choices=datetime_info)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
bike <- bike_add_time %>% filter(hour == input$dataSelect)
ggplot(filter(bike, workingday==1), aes(x=hour, y=count)) +
geom_point()
})
}
# Run the application
shinyApp(ui = ui, server = server)
Shiny applications not supported in static R Markdown documents
9.4 API를 이용한 국토부 실거래가 조회2
9.4.1 파일 불러오기
- 텍스트 파일 불러오기
## Warning: package 'lubridate' was built under R version 4.0.2
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
## Warning: package 'zoo' was built under R version 4.0.2
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Warning: package 'showtext' was built under R version 4.0.2
## Loading required package: sysfonts
## Warning: package 'sysfonts' was built under R version 4.0.2
## Loading required package: showtextdb
## Warning: package 'showtextdb' was built under R version 4.0.2
bgd = read_csv(file = './data/bgd2.txt',
col_types = list(
code = col_character(),
name = col_character(),
exist = col_character()
),
col_names = TRUE
)
# 컬럼명을 영문으로 변경
colnames(bgd) <- c('code','name','exist')
# 현재 존재하는 법정동만 따로 저장
exist_bgd = filter(bgd, exist == '존재')
# 시도 코드와 읍면동 코드 분리 (시도코드는 5째자리, 이후는 읍면동 코드)
bgd$sido <- substr(bgd$code, 1,5)
bgd$eupMyunDong <- substr(bgd$code, 6,100)
9.4.2 특정 구의 시군구 코드 알아내기
sido_code <- bgd %>%
filter(grepl("송파구", name, fixed = TRUE)) %>%
filter(eupMyunDong == '00000') %>%
select(sido)
sido_code
## # A tibble: 1 x 1
## sido
## <chr>
## 1 11710
9.4.3 구군 명을 넣으면 구군코드를 반환하는 함수 만들기
getGuGunCode <- function(gugun){
bgd = read_csv(
file = './data/bgd2.txt',
col_types = list(
code = col_character(),
name = col_character(),
exist = col_character()
),
col_names = TRUE
)
colnames(bgd) <- c('code','name','exist')
bgd$sido <- substr(bgd$code, 1,5)
bgd$eupMyunDong <- substr(bgd$code, 6,100)
bgd %>%
filter(eupMyunDong == '00000')
sido_code <- bgd %>%
filter(grepl(gugun, name, fixed = TRUE)) %>%
filter(eupMyunDong == '00000') %>%
select(sido)
return (sido_code$sido)
}
- 테스트 해보기
## [1] "11530"
## [1] "48880"
- 서비스키 등록
path <- "http://openapi.molit.go.kr/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTradeDev?"
key <- "%2F9qD%2FPbjCfTTM33R%2FzWiOuX5MBKgkrrwi62FHsQx%2B5YlpUFzvtVuxH8ehLKhuFzf53TQvU6OYF2SGI2Mx9SwHA%3D%3D"
service_key <- utf8::utf8_encode(URLencode(key))
- 월 더하는 함수
addmonth <- function(yearMonth){
post_fix <- '01'
da <- paste(yearMonth , post_fix)
da2<-substr(ymd(da) %m+% months(1),1,7)
gsub("-", "", da2)
}
- 시작월 부터 끝월 사이 벡터로 구하기
startEndMonth <- function(start, end){
current <- start
vector <- NULL
while(current <= end){
vector <- c(vector, current)
current <- addmonth(current)
}
return(vector)
}
- 테스트 해보기
## [1] "201901" "201902" "201903" "201904" "201905" "201906"
- 실거래 response 를 받아서 Tibble 로 반환하는 함수
resAsTibble <- function(yearMonth, guGunCode){
request <- paste(path,
"LAWD_CD","=",guGunCode,"&",
"DEAL_YMD","=",yearMonth,"&",
"serviceKey","=",service_key,
sep="")
response <- GET(request)
content <- content(response, "text",encoding = "UTF-8")
res <- fromJSON(content)
apt = res$response$body$items$item
# 컬럼명을 영문으로 변경
colnames(apt) <- c("price", "build_year", "year", "road_name", "bon", "bu", "gungu", "serial", "gr_code",
"road_code", "bgd","bgd_bon", "bgd_bu","bgd_sigungu","bgd_emd", "bgd_gibun","apt_name",
"month", "day", "serial2", "size", "gibun", "area_code", "floor")
as.tibble(apt)
#아파트 가격에서 ',' 를 빼고 숫자로 변환
apt$price <- as.numeric(gsub('[$,]', '', apt$price))
# str(apt)
#평단가 계산
apt <- mutate(apt, price_by_area = apt$price / (as.double(apt$size) / 3.3))
apt <- mutate(apt, deal_ymd = as.Date( paste(apt$year, apt$month, apt$day,sep="-"),"%Y-%m-%d") )
#한글 값들을 utf-8 로 수정
apt$road_name = utf8::utf8_encode(apt$road_name)
apt$apt_name = utf8::utf8_encode(apt$apt_name)
apt[,'build_year'] = floor(apt[,'build_year'])
return(apt)
}
- 테스트 해보기
## Warning: `as.tibble()` is deprecated as of tibble 2.0.0.
## Please use `as_tibble()` instead.
## The signature and semantics have changed, see `?as_tibble`.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## price build_year year road_name bon bu gungu serial gr_code
## 1 265000 2011 2019 경인로 00662 00000 11530 01 0
## 2 30800 1987 2019 신도림로11가길 00036 00000 11530 01 0
## 3 51000 2006 2019 경인로 00584 00000 11530 01 0
## 4 80000 2003 2019 신도림로 00032 00000 11530 01 0
## 5 83000 2000 2019 경인로 00643 00000 11530 01 0
## 6 108500 2011 2019 경인로 00662 00000 11530 01 0
## road_code bgd bgd_bon bgd_bu bgd_sigungu bgd_emd bgd_gibun
## 1 3000028 신도림동 0692 0000 11530 10100 1
## 2 4148391 신도림동 0290 0000 11530 10100 1
## 3 3000028 신도림동 0412 0003 11530 10100 1
## 4 3116008 신도림동 0647 0000 11530 10100 1
## 5 3000028 신도림동 0644 0000 11530 10100 1
## 6 3000028 신도림동 0692 0000 11530 10100 1
## apt_name month day serial2 size gibun area_code floor
## 1 디큐브시티 4 1 11530-3480 199.790 692 11530 51
## 2 미성 4 4 11530-133 37.910 290 11530 4
## 3 신도림팰러티움 4 8 11530-3233 84.950 412-3 11530 21
## 4 대림e-편한세상5 4 13 11530-150 84.789 647 11530 17
## 5 동아2 4 14 11530-131 84.908 644 11530 25
## 6 디큐브시티 4 15 11530-3480 125.360 692 11530 11
## price_by_area deal_ymd
## 1 4377.096 2019-04-01
## 2 2681.087 2019-04-04
## 3 1981.165 2019-04-08
## 4 3113.611 2019-04-13
## 5 3225.844 2019-04-14
## 6 2856.174 2019-04-15
getRealPrice <- function(start, end, guGunName='송파구'){
# 한글 구군명을 통해 구군코드 얻기
guGunCode = getGuGunCode(guGunName)
# 시작월 부터 종료월 까지의 각각의 월 리스트
monthList <- startEndMonth(start, end)
#print(monthList)
# 반환할 객체 초기화
monthList
datalist = list()
# 각 월별로 실거래가 조회 해서 데이터프레임 합치기
for (i in 1:length(monthList)){
temp_list <- resAsTibble(monthList[i], guGunCode)
datalist[[i]] <- temp_list
# datalist
}
return_data = do.call(rbind, datalist)
print("1번")
print(head(return_data))
str(return_data)
return(as.tibble(return_data))
#return datalist
}
- 테스트 해보기
## [1] "1번"
## price build_year year road_name bon bu gungu serial gr_code road_code
## 1 140500 2006 2018 잠실로 00088 00000 11710 01 0 3123015
## 2 147000 2008 2018 올림픽로 00135 00000 11710 01 0 3123023
## 3 140000 2007 2018 잠실로 00062 00000 11710 01 0 3123015
## 4 138000 2007 2018 잠실로 00062 00000 11710 01 0 3123015
## 5 173000 1978 2018 송파대로 00567 00000 11710 01 0 2005011
## 6 200000 2008 2018 올림픽로 00099 00000 11710 01 0 3123023
## bgd bgd_bon bgd_bu bgd_sigungu bgd_emd bgd_gibun apt_name month
## 1 잠실동 0044 0000 11710 10100 1 레이크팰리스 1
## 2 잠실동 0022 0000 11710 10100 1 리센츠 1
## 3 잠실동 0035 0000 11710 10100 1 트리지움 1
## 4 잠실동 0035 0000 11710 10100 1 트리지움 1
## 5 잠실동 0027 0000 11710 10100 1 주공아파트 5단지 1
## 6 잠실동 0019 0000 11710 10100 1 잠실엘스 1
## day serial2 size gibun area_code floor price_by_area deal_ymd
## 1 2 11710-5957 84.82 44 11710 19 5466.282 2018-01-02
## 2 2 11710-6249 84.99 22 11710 20 5707.730 2018-01-02
## 3 2 11710-6028 84.95 35 11710 10 5438.493 2018-01-02
## 4 2 11710-6028 84.95 35 11710 19 5360.800 2018-01-02
## 5 3 11710-164 76.50 27 11710 1 7462.745 2018-01-03
## 6 3 11710-6346 119.93 19 11710 23 5503.210 2018-01-03
## 'data.frame': 170 obs. of 26 variables:
## $ price : num 140500 147000 140000 138000 173000 ...
## $ build_year : num 2006 2008 2007 2007 1978 ...
## $ year : int 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 ...
## $ road_name : chr "잠실로" "올림픽로" "잠실로" "잠실로" ...
## $ bon : chr "00088" "00135" "00062" "00062" ...
## $ bu : chr "00000" "00000" "00000" "00000" ...
## $ gungu : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ serial : chr "01" "01" "01" "01" ...
## $ gr_code : int 0 0 0 0 0 0 0 0 0 0 ...
## $ road_code : int 3123015 3123023 3123015 3123015 2005011 3123023 3123023 3123023 3123015 3123015 ...
## $ bgd : chr " 잠실동" " 잠실동" " 잠실동" " 잠실동" ...
## $ bgd_bon : chr "0044" "0022" "0035" "0035" ...
## $ bgd_bu : chr "0000" "0000" "0000" "0000" ...
## $ bgd_sigungu : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ bgd_emd : int 10100 10100 10100 10100 10100 10100 10100 10100 10100 10100 ...
## $ bgd_gibun : int 1 1 1 1 1 1 1 1 1 1 ...
## $ apt_name : chr "레이크팰리스" "리센츠" "트리지움" "트리지움" ...
## $ month : int 1 1 1 1 1 1 1 1 1 1 ...
## $ day : int 2 2 2 2 3 3 3 3 3 3 ...
## $ serial2 : chr "11710-5957" "11710-6249" "11710-6028" "11710-6028" ...
## $ size : num 84.8 85 85 85 76.5 ...
## $ gibun : chr "44" "22" "35" "35" ...
## $ area_code : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ floor : int 19 20 10 19 1 23 9 16 21 23 ...
## $ price_by_area: num 5466 5708 5438 5361 7463 ...
## $ deal_ymd : Date, format: "2018-01-02" "2018-01-02" ...
## [1] "2번"
## # A tibble: 6 x 26
## price build_year year road_name bon bu gungu serial gr_code road_code
## <dbl> <dbl> <int> <chr> <chr> <chr> <int> <chr> <int> <int>
## 1 140500 2006 2018 잠실로 00088 00000 11710 01 0 3123015
## 2 147000 2008 2018 올림픽로 00135 00000 11710 01 0 3123023
## 3 140000 2007 2018 잠실로 00062 00000 11710 01 0 3123015
## 4 138000 2007 2018 잠실로 00062 00000 11710 01 0 3123015
## 5 173000 1978 2018 송파대로 00567 00000 11710 01 0 2005011
## 6 200000 2008 2018 올림픽로 00099 00000 11710 01 0 3123023
## # … with 16 more variables: bgd <chr>, bgd_bon <chr>, bgd_bu <chr>,
## # bgd_sigungu <int>, bgd_emd <int>, bgd_gibun <int>, apt_name <chr>,
## # month <int>, day <int>, serial2 <chr>, size <dbl>, gibun <chr>,
## # area_code <int>, floor <int>, price_by_area <dbl>, deal_ymd <date>
## tibble [170 × 26] (S3: tbl_df/tbl/data.frame)
## $ price : num [1:170] 140500 147000 140000 138000 173000 ...
## $ build_year : num [1:170] 2006 2008 2007 2007 1978 ...
## $ year : int [1:170] 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 ...
## $ road_name : chr [1:170] "잠실로" "올림픽로" "잠실로" "잠실로" ...
## $ bon : chr [1:170] "00088" "00135" "00062" "00062" ...
## $ bu : chr [1:170] "00000" "00000" "00000" "00000" ...
## $ gungu : int [1:170] 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ serial : chr [1:170] "01" "01" "01" "01" ...
## $ gr_code : int [1:170] 0 0 0 0 0 0 0 0 0 0 ...
## $ road_code : int [1:170] 3123015 3123023 3123015 3123015 2005011 3123023 3123023 3123023 3123015 3123015 ...
## $ bgd : chr [1:170] " 잠실동" " 잠실동" " 잠실동" " 잠실동" ...
## $ bgd_bon : chr [1:170] "0044" "0022" "0035" "0035" ...
## $ bgd_bu : chr [1:170] "0000" "0000" "0000" "0000" ...
## $ bgd_sigungu : int [1:170] 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ bgd_emd : int [1:170] 10100 10100 10100 10100 10100 10100 10100 10100 10100 10100 ...
## $ bgd_gibun : int [1:170] 1 1 1 1 1 1 1 1 1 1 ...
## $ apt_name : chr [1:170] "레이크팰리스" "리센츠" "트리지움" "트리지움" ...
## $ month : int [1:170] 1 1 1 1 1 1 1 1 1 1 ...
## $ day : int [1:170] 2 2 2 2 3 3 3 3 3 3 ...
## $ serial2 : chr [1:170] "11710-5957" "11710-6249" "11710-6028" "11710-6028" ...
## $ size : num [1:170] 84.8 85 85 85 76.5 ...
## $ gibun : chr [1:170] "44" "22" "35" "35" ...
## $ area_code : int [1:170] 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ floor : int [1:170] 19 20 10 19 1 23 9 16 21 23 ...
## $ price_by_area: num [1:170] 5466 5708 5438 5361 7463 ...
## $ deal_ymd : Date[1:170], format: "2018-01-02" "2018-01-02" ...
- 데이터 확인하기
## [1] 170
## price build_year year road_name
## Min. : 65000 Min. :1978 Min. :2018 Length:170
## 1st Qu.:140000 1st Qu.:2005 1st Qu.:2018 Class :character
## Median :158000 Median :2007 Median :2018 Mode :character
## Mean :157854 Mean :2002 Mean :2018
## 3rd Qu.:169925 3rd Qu.:2008 3rd Qu.:2019
## Max. :320000 Max. :2008 Max. :2019
## bon bu gungu serial
## Length:170 Length:170 Min. :11710 Length:170
## Class :character Class :character 1st Qu.:11710 Class :character
## Mode :character Mode :character Median :11710 Mode :character
## Mean :11710
## 3rd Qu.:11710
## Max. :11710
## gr_code road_code bgd bgd_bon
## Min. :0 Min. :2005011 Length:170 Length:170
## 1st Qu.:0 1st Qu.:3123015 Class :character Class :character
## Median :0 Median :3123023 Mode :character Mode :character
## Mean :0 Mean :3134744
## 3rd Qu.:0 3rd Qu.:3123023
## Max. :0 Max. :4169439
## bgd_bu bgd_sigungu bgd_emd bgd_gibun
## Length:170 Min. :11710 Min. :10100 Min. :1
## Class :character 1st Qu.:11710 1st Qu.:10100 1st Qu.:1
## Mode :character Median :11710 Median :10100 Median :1
## Mean :11710 Mean :10100 Mean :1
## 3rd Qu.:11710 3rd Qu.:10100 3rd Qu.:1
## Max. :11710 Max. :10100 Max. :1
## apt_name month day serial2
## Length:170 Min. : 1.000 Min. : 1.000 Length:170
## Class :character 1st Qu.: 3.000 1st Qu.: 2.000 Class :character
## Mode :character Median : 5.000 Median : 5.000 Mode :character
## Mean : 5.471 Mean : 6.424
## 3rd Qu.: 8.000 3rd Qu.: 9.000
## Max. :12.000 Max. :24.000
## size gibun area_code floor
## Min. : 27.68 Length:170 Min. :11710 Min. : 1.00
## 1st Qu.: 76.50 Class :character 1st Qu.:11710 1st Qu.: 8.00
## Median : 84.83 Mode :character Median :11710 Median :13.00
## Mean : 88.72 Mean :11710 Mean :14.39
## 3rd Qu.: 84.99 3rd Qu.:11710 3rd Qu.:20.00
## Max. :244.73 Max. :11710 Max. :46.00
## price_by_area deal_ymd
## Min. : 2860 Min. :2018-01-02
## 1st Qu.: 5513 1st Qu.:2018-05-04
## Median : 6171 Median :2018-09-01
## Mean : 6193 Mean :2018-09-05
## 3rd Qu.: 7052 3rd Qu.:2019-01-10
## Max. :10718 Max. :2019-05-03
- 잠실엘스 가격만 고르기
## [1] 34
- 그래프 그리기
ggplot(data=munjung, mapping = aes(x=deal_ymd, y=price_by_area, group = size)) +
geom_point(stat = "identity",mapping = aes(color=size)) +
geom_line() +
scale_x_date(date_breaks = "1 month", date_labels ="%Y-%m") +
facet_wrap(~ size, dir="v", nrow = 5) +
theme(axis.text.x=element_text(angle=90, hjust=1, vjust=1))
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## List of 93
## $ line :List of 6
## ..$ colour : chr "black"
## ..$ size : num 0.5
## ..$ linetype : num 1
## ..$ lineend : chr "butt"
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ rect :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ size : num 0.5
## ..$ linetype : num 1
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ text :List of 11
## ..$ family : chr ""
## ..$ face : chr "plain"
## ..$ colour : chr "black"
## ..$ size : num 11
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : num 0
## ..$ lineheight : num 0.9
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ title : NULL
## $ aspect.ratio : NULL
## $ axis.title : NULL
## $ axis.title.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.bottom : NULL
## $ axis.title.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y.left : NULL
## $ axis.title.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey30"
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.bottom : NULL
## $ axis.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y.left : NULL
## $ axis.text.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.ticks :List of 6
## ..$ colour : chr "grey20"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ lineend : NULL
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ axis.ticks.x : NULL
## $ axis.ticks.x.top : NULL
## $ axis.ticks.x.bottom : NULL
## $ axis.ticks.y : NULL
## $ axis.ticks.y.left : NULL
## $ axis.ticks.y.right : NULL
## $ axis.ticks.length : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ axis.ticks.length.x : NULL
## $ axis.ticks.length.x.top : NULL
## $ axis.ticks.length.x.bottom: NULL
## $ axis.ticks.length.y : NULL
## $ axis.ticks.length.y.left : NULL
## $ axis.ticks.length.y.right : NULL
## $ axis.line : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.line.x : NULL
## $ axis.line.x.top : NULL
## $ axis.line.x.bottom : NULL
## $ axis.line.y : NULL
## $ axis.line.y.left : NULL
## $ axis.line.y.right : NULL
## $ legend.background :List of 5
## ..$ fill : NULL
## ..$ colour : logi NA
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## $ legend.spacing.x : NULL
## $ legend.spacing.y : NULL
## $ legend.key :List of 5
## ..$ fill : chr "white"
## ..$ colour : logi NA
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ legend.key.size : 'simpleUnit' num 1.2lines
## ..- attr(*, "unit")= int 3
## $ legend.key.height : NULL
## $ legend.key.width : NULL
## $ legend.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.text.align : NULL
## $ legend.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.title.align : NULL
## $ legend.position : chr "right"
## $ legend.direction : NULL
## $ legend.justification : chr "center"
## $ legend.box : NULL
## $ legend.box.just : NULL
## $ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
## ..- attr(*, "unit")= int 1
## $ legend.box.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.box.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## $ panel.background :List of 5
## ..$ fill : chr "white"
## ..$ colour : logi NA
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ panel.border :List of 5
## ..$ fill : logi NA
## ..$ colour : chr "grey20"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ panel.spacing : 'simpleUnit' num 5.5points
## ..- attr(*, "unit")= int 8
## $ panel.spacing.x : NULL
## $ panel.spacing.y : NULL
## $ panel.grid :List of 6
## ..$ colour : chr "grey92"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ lineend : NULL
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ panel.grid.major : NULL
## $ panel.grid.minor :List of 6
## ..$ colour : NULL
## ..$ size : 'rel' num 0.5
## ..$ linetype : NULL
## ..$ lineend : NULL
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ panel.grid.major.x : NULL
## $ panel.grid.major.y : NULL
## $ panel.grid.minor.x : NULL
## $ panel.grid.minor.y : NULL
## $ panel.ontop : logi FALSE
## $ plot.background :List of 5
## ..$ fill : NULL
## ..$ colour : chr "white"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ plot.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 1.2
## ..$ hjust : num 0
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 5.5points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.title.position : chr "panel"
## $ plot.subtitle :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 5.5points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.caption :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 0.8
## ..$ hjust : num 1
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 5.5points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.caption.position : chr "panel"
## $ plot.tag :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 1.2
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ plot.tag.position : chr "topleft"
## $ plot.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
## ..- attr(*, "unit")= int 8
## $ strip.background :List of 5
## ..$ fill : chr "grey85"
## ..$ colour : chr "grey20"
## ..$ size : NULL
## ..$ linetype : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ strip.background.x : NULL
## $ strip.background.y : NULL
## $ strip.placement : chr "inside"
## $ strip.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey10"
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 4.4points 4.4points 4.4points 4.4points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ strip.text.x : NULL
## $ strip.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ strip.switch.pad.grid : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ strip.switch.pad.wrap : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ strip.text.y.left :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi TRUE
## - attr(*, "validate")= logi TRUE
9.5 Google 지도를 이용한 부동산 정보 시각화
## [1] "1번"
## price build_year year road_name bon bu gungu serial gr_code road_code
## 1 140500 2006 2018 잠실로 00088 00000 11710 01 0 3123015
## 2 147000 2008 2018 올림픽로 00135 00000 11710 01 0 3123023
## 3 140000 2007 2018 잠실로 00062 00000 11710 01 0 3123015
## 4 138000 2007 2018 잠실로 00062 00000 11710 01 0 3123015
## 5 173000 1978 2018 송파대로 00567 00000 11710 01 0 2005011
## 6 200000 2008 2018 올림픽로 00099 00000 11710 01 0 3123023
## bgd bgd_bon bgd_bu bgd_sigungu bgd_emd bgd_gibun apt_name month
## 1 잠실동 0044 0000 11710 10100 1 레이크팰리스 1
## 2 잠실동 0022 0000 11710 10100 1 리센츠 1
## 3 잠실동 0035 0000 11710 10100 1 트리지움 1
## 4 잠실동 0035 0000 11710 10100 1 트리지움 1
## 5 잠실동 0027 0000 11710 10100 1 주공아파트 5단지 1
## 6 잠실동 0019 0000 11710 10100 1 잠실엘스 1
## day serial2 size gibun area_code floor price_by_area deal_ymd
## 1 2 11710-5957 84.82 44 11710 19 5466.282 2018-01-02
## 2 2 11710-6249 84.99 22 11710 20 5707.730 2018-01-02
## 3 2 11710-6028 84.95 35 11710 10 5438.493 2018-01-02
## 4 2 11710-6028 84.95 35 11710 19 5360.800 2018-01-02
## 5 3 11710-164 76.50 27 11710 1 7462.745 2018-01-03
## 6 3 11710-6346 119.93 19 11710 23 5503.210 2018-01-03
## 'data.frame': 120 obs. of 26 variables:
## $ price : num 140500 147000 140000 138000 173000 ...
## $ build_year : num 2006 2008 2007 2007 1978 ...
## $ year : int 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 ...
## $ road_name : chr "잠실로" "올림픽로" "잠실로" "잠실로" ...
## $ bon : chr "00088" "00135" "00062" "00062" ...
## $ bu : chr "00000" "00000" "00000" "00000" ...
## $ gungu : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ serial : chr "01" "01" "01" "01" ...
## $ gr_code : int 0 0 0 0 0 0 0 0 0 0 ...
## $ road_code : int 3123015 3123023 3123015 3123015 2005011 3123023 3123023 3123023 3123015 3123015 ...
## $ bgd : chr " 잠실동" " 잠실동" " 잠실동" " 잠실동" ...
## $ bgd_bon : chr "0044" "0022" "0035" "0035" ...
## $ bgd_bu : chr "0000" "0000" "0000" "0000" ...
## $ bgd_sigungu : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ bgd_emd : int 10100 10100 10100 10100 10100 10100 10100 10100 10100 10100 ...
## $ bgd_gibun : int 1 1 1 1 1 1 1 1 1 1 ...
## $ apt_name : chr "레이크팰리스" "리센츠" "트리지움" "트리지움" ...
## $ month : int 1 1 1 1 1 1 1 1 1 1 ...
## $ day : int 2 2 2 2 3 3 3 3 3 3 ...
## $ serial2 : chr "11710-5957" "11710-6249" "11710-6028" "11710-6028" ...
## $ size : num 84.8 85 85 85 76.5 ...
## $ gibun : chr "44" "22" "35" "35" ...
## $ area_code : int 11710 11710 11710 11710 11710 11710 11710 11710 11710 11710 ...
## $ floor : int 19 20 10 19 1 23 9 16 21 23 ...
## $ price_by_area: num 5466 5708 5438 5361 7463 ...
## $ deal_ymd : Date, format: "2018-01-02" "2018-01-02" ...
by_apt_name <- group_by(aptList, bgd, apt_name)
aptListDealCount <- summarise(by_apt_name, deal_count =n())
## `summarise()` regrouping output by 'bgd' (override with `.groups` argument)
## # A tibble: 11 x 3
## # Groups: bgd [1]
## bgd apt_name deal_count
## <chr> <chr> <int>
## 1 " 잠실동" 갤러리아팰리스 5
## 2 " 잠실동" 레이크팰리스 9
## 3 " 잠실동" 리센츠 31
## 4 " 잠실동" 아시아선수촌아파트 7
## 5 " 잠실동" 우성아파트 7
## 6 " 잠실동" 잠실엘스 24
## 7 " 잠실동" 잠실월드메르디앙 1
## 8 " 잠실동" 주공아파트 5단지 10
## 9 " 잠실동" 트리지움 22
## 10 " 잠실동" 포스코더샵 1
## 11 " 잠실동" 현대 3
## # A tibble: 11 x 4
## # Groups: bgd [1]
## bgd apt_name deal_count address
## <chr> <chr> <int> <chr>
## 1 " 잠실동" 갤러리아팰리스 5 " 잠실동 갤러리아팰리스"
## 2 " 잠실동" 레이크팰리스 9 " 잠실동 레이크팰리스"
## 3 " 잠실동" 리센츠 31 " 잠실동 리센츠"
## 4 " 잠실동" 아시아선수촌아파트 7 " 잠실동 아시아선수촌아파트"
## 5 " 잠실동" 우성아파트 7 " 잠실동 우성아파트"
## 6 " 잠실동" 잠실엘스 24 " 잠실동 잠실엘스"
## 7 " 잠실동" 잠실월드메르디앙 1 " 잠실동 잠실월드메르디앙"
## 8 " 잠실동" 주공아파트 5단지 10 " 잠실동 주공아파트 5단지"
## 9 " 잠실동" 트리지움 22 " 잠실동 트리지움"
## 10 " 잠실동" 포스코더샵 1 " 잠실동 포스코더샵"
## 11 " 잠실동" 현대 3 " 잠실동 현대"
## Warning: package 'ggmap' was built under R version 4.0.2
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
register_google(key = 'AIzaSyAeIGqiB-ti8UqdZ0WeduKjQt4lkFPpSU4')
aptListDealCount2 <- aptListDealCount %>%
mutate(lon = as.numeric(geocode(location = enc2utf8(x = paste(address, '&language=ko')) ,output = 'latlona',source = 'google')[1,1]) ) %>%
mutate(lat = as.numeric(geocode(location = enc2utf8(x = paste(address, '&language=ko')) ,output = 'latlona',source = 'google')[1,2]) )
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EA%B0%A4%EB%9F%AC%EB%A6%AC%EC%95%84%ED%8C%B0%EB%A6%AC%EC%8A%A4+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 갤러리아팰리스 &lan..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 갤러리아팰리스 &lan..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EB%A0%88%EC%9D%B4%ED%81%AC%ED%8C%B0%EB%A6%AC%EC%8A%A4+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 레이크팰리스 &lang..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 레이크팰리스 &lang..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EB%A6%AC%EC%84%BC%EC%B8%A0+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 리센츠 &languag..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 리센츠 &languag..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%95%84%EC%8B%9C%EC%95%84%EC%84%A0%EC%88%98%EC%B4%8C%EC%95%84%ED%8C%8C%ED%8A%B8+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 아시아선수촌아파트 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 아시아선수촌아파트 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%9A%B0%EC%84%B1%EC%95%84%ED%8C%8C%ED%8A%B8+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 우성아파트 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 우성아파트 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%9E%A0%EC%8B%A4%EC%97%98%EC%8A%A4+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 잠실엘스 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 잠실엘스 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%9E%A0%EC%8B%A4%EC%9B%94%EB%93%9C%EB%A9%94%EB%A5%B4%EB%94%94%EC%95%99+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 잠실월드메르디앙 &la..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 잠실월드메르디앙 &la..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%A3%BC%EA%B3%B5%EC%95%84%ED%8C%8C%ED%8A%B8+5%EB%8B%A8%EC%A7%80+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 주공아파트 5단지 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 주공아파트 5단지 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%ED%8A%B8%EB%A6%AC%EC%A7%80%EC%9B%80+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 트리지움 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 트리지움 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%ED%8F%AC%EC%8A%A4%EC%BD%94%EB%8D%94%EC%83%B5+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 포스코더샵 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 포스코더샵 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%ED%98%84%EB%8C%80+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lon`.
## ℹ Geocoding " 잠실동 현대 &language=ko" failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lon` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 현대 &language=ko" failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EA%B0%A4%EB%9F%AC%EB%A6%AC%EC%95%84%ED%8C%B0%EB%A6%AC%EC%8A%A4+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 갤러리아팰리스 &lan..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 갤러리아팰리스 &lan..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EB%A0%88%EC%9D%B4%ED%81%AC%ED%8C%B0%EB%A6%AC%EC%8A%A4+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 레이크팰리스 &lang..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 레이크팰리스 &lang..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EB%A6%AC%EC%84%BC%EC%B8%A0+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 리센츠 &languag..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 리센츠 &languag..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%95%84%EC%8B%9C%EC%95%84%EC%84%A0%EC%88%98%EC%B4%8C%EC%95%84%ED%8C%8C%ED%8A%B8+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 아시아선수촌아파트 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 아시아선수촌아파트 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%9A%B0%EC%84%B1%EC%95%84%ED%8C%8C%ED%8A%B8+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 우성아파트 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 우성아파트 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%9E%A0%EC%8B%A4%EC%97%98%EC%8A%A4+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 잠실엘스 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 잠실엘스 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%9E%A0%EC%8B%A4%EC%9B%94%EB%93%9C%EB%A9%94%EB%A5%B4%EB%94%94%EC%95%99+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 잠실월드메르디앙 &la..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 잠실월드메르디앙 &la..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%EC%A3%BC%EA%B3%B5%EC%95%84%ED%8C%8C%ED%8A%B8+5%EB%8B%A8%EC%A7%80+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 주공아파트 5단지 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 주공아파트 5단지 &l..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%ED%8A%B8%EB%A6%AC%EC%A7%80%EC%9B%80+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 트리지움 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 트리지움 &langua..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%ED%8F%AC%EC%8A%A4%EC%BD%94%EB%8D%94%EC%83%B5+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 포스코더샵 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 포스코더샵 &langu..." failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=%EC%9E%A0%EC%8B%A4%EB%8F%99+%ED%98%84%EB%8C%80+&language=ko&key=xxx-ti8UqdZ0WeduKjQt4lkFPpSU4
## Warning: Problem with `mutate()` input `lat`.
## ℹ Geocoding " 잠실동 현대 &language=ko" failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
##
## ℹ Input `lat` is `as.numeric(...)`.
## ℹ The error occurred in group 1: bgd = " 잠실동".
## Warning: Geocoding " 잠실동 현대 &language=ko" failed with error:
## You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
## # A tibble: 11 x 6
## # Groups: bgd [1]
## bgd apt_name deal_count address lon lat
## <chr> <chr> <int> <chr> <dbl> <dbl>
## 1 " 잠실동" 갤러리아팰리스 5 " 잠실동 갤러리아팰리스" NA NA
## 2 " 잠실동" 레이크팰리스 9 " 잠실동 레이크팰리스" NA NA
## 3 " 잠실동" 리센츠 31 " 잠실동 리센츠" NA NA
## 4 " 잠실동" 아시아선수촌아파트… 7 " 잠실동 아시아선수촌아파트"… NA NA
## 5 " 잠실동" 우성아파트 7 " 잠실동 우성아파트" NA NA
## 6 " 잠실동" 잠실엘스 24 " 잠실동 잠실엘스" NA NA
## 7 " 잠실동" 잠실월드메르디앙 1 " 잠실동 잠실월드메르디앙" NA NA
## 8 " 잠실동" 주공아파트 5단지 10 " 잠실동 주공아파트 5단지" NA NA
## 9 " 잠실동" 트리지움 22 " 잠실동 트리지움" NA NA
## 10 " 잠실동" 포스코더샵 1 " 잠실동 포스코더샵" NA NA
## 11 " 잠실동" 현대 3 " 잠실동 현대" NA NA