IT기술/BigData

Case 6. 서울시 Wifi Zone 설치 정보 분석하기

dobbby 2014. 2. 21. 11:21
반응형

> setwd("d:/yul/temp")

> rm(list=ls())

> install.packages("doParallel")    #대량의 작업일 경우 병렬처리를 하게 해주는 패키지

Installing package into ‘C:/Users/stu/Documents/R/win-library/3.0’

(as ‘lib’ is unspecified)

--- Please select a CRAN mirror for use in this session ---

also installing the dependencies ‘foreach’, ‘iterators’


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/foreach_1.4.1.zip'

Content type 'application/zip' length 388628 bytes (379 Kb)

opened URL

downloaded 379 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/iterators_1.0.6.zip'

Content type 'application/zip' length 317912 bytes (310 Kb)

opened URL

downloaded 310 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/doParallel_1.0.6.zip'

Content type 'application/zip' length 181694 bytes (177 Kb)

opened URL

downloaded 177 Kb


package ‘foreach’ successfully unpacked and MD5 sums checked

package ‘iterators’ successfully unpacked and MD5 sums checked

package ‘doParallel’ successfully unpacked and MD5 sums checked


The downloaded binary packages are in

        C:\Users\stu\AppData\Local\Temp\RtmpueT0jG\downloaded_packages

> library(doParallel)

Loading required package: foreach

foreach: simple, scalable parallel programming from Revolution Analytics

Use Revolution R for scalability, fault tolerance and more.

http://www.revolutionanalytics.com

Loading required package: iterators

Loading required package: parallel

> registerDoParallel(cores=4)    #최대사용CPU개수 4개

> install.packages("ggplot2")    #지도위에 그림을 표시해주는 패키지

Installing package into ‘C:/Users/stu/Documents/R/win-library/3.0’

(as ‘lib’ is unspecified)

also installing the dependencies ‘colorspace’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘digest’, ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/colorspace_1.2-4.zip'

Content type 'application/zip' length 384360 bytes (375 Kb)

opened URL

downloaded 375 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/dichromat_2.0-0.zip'

Content type 'application/zip' length 147536 bytes (144 Kb)

opened URL

downloaded 144 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/munsell_0.4.2.zip'

Content type 'application/zip' length 126108 bytes (123 Kb)

opened URL

downloaded 123 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/labeling_0.2.zip'

Content type 'application/zip' length 40403 bytes (39 Kb)

opened URL

downloaded 39 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/digest_0.6.4.zip'

Content type 'application/zip' length 136446 bytes (133 Kb)

opened URL

downloaded 133 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/gtable_0.1.2.zip'

Content type 'application/zip' length 63496 bytes (62 Kb)

opened URL

downloaded 62 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/reshape2_1.2.2.zip'

Content type 'application/zip' length 60504 bytes (59 Kb)

opened URL

downloaded 59 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/scales_0.2.3.zip'

Content type 'application/zip' length 157571 bytes (153 Kb)

opened URL

downloaded 153 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/proto_0.3-10.zip'

Content type 'application/zip' length 458271 bytes (447 Kb)

opened URL

downloaded 447 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/ggplot2_0.9.3.1.zip'

Content type 'application/zip' length 2657507 bytes (2.5 Mb)

opened URL

downloaded 2.5 Mb


package ‘colorspace’ successfully unpacked and MD5 sums checked

package ‘dichromat’ successfully unpacked and MD5 sums checked

package ‘munsell’ successfully unpacked and MD5 sums checked

package ‘labeling’ successfully unpacked and MD5 sums checked

package ‘digest’ successfully unpacked and MD5 sums checked

package ‘gtable’ successfully unpacked and MD5 sums checked

package ‘reshape2’ successfully unpacked and MD5 sums checked

package ‘scales’ successfully unpacked and MD5 sums checked

package ‘proto’ successfully unpacked and MD5 sums checked

package ‘ggplot2’ successfully unpacked and MD5 sums checked


The downloaded binary packages are in

        C:\Users\stu\AppData\Local\Temp\RtmpueT0jG\downloaded_packages

> library(ggplot2)

> wifi_new<-read.csv("공공WiFi위치정보.csv",encoding="EUC-KR")

> wifi_new    #이 변수에 담긴 내용 확인


※ CSV 파일에서 한글 컬럼명 첫 줄은 삭제한다.


     구명     유형       지역명 설치위치.X좌표. 설치위치.Y좌표.

1   GU_NM CATEGORY   PLACE_NAME         INSTL_X         INSTL_Y

2  강남구 주요거리   선릉역주변      204434.122      445019.079

3  강남구 공공청사 아동복지센터      207778.344      442262.396

4  강남구 주요거리 청담패션거리       203548.13      447486.519

5  강남구 주요거리 청담패션거리      203454.203      447149.175

6  강남구 주요거리 청담패션거리      203491.311      447245.814

7  강남구 주요거리 과학기술원앞      202669.348      444616.912

8  강남구 주요거리   역삼역주변      203097.973      444554.735

9  강남구 주요거리   선릉역주변      204205.918      444999.236

10 강남구 주요거리   선릉역주변      204192.028      444923.168

11 강남구 주요거리   선릉역주변      204281.325      445106.392

12 강남구 주요거리   역삼역주변      203174.041      444505.787

13 강남구 주요거리       국기원      202617.754      444730.022

14 강남구 주요거리 청담패션거리      203517.703      447358.196

15 강남구 주요거리 청담패션거리      203565.328      447437.638

16 강남구 주요거리 청담패션거리      203522.995      447280.144

   설치기관.회사.

1       INSTL_DIV

2             SKT

3          서울시

4             SKT

5             SKT

6             SKT

7             SKT

8             SKT

9             SKT

10            SKT

11            SKT

12            SKT

13            SKT

14            SKT

15            SKT

16            SKT


> ggplot(wifi_new, aes(x=factor(1))) + geom_bar(aes(fill=INSTL_DIV),width=1)+coord_polar(theta="y")+xlab("")+ylab("")



> install.packages("ggmap")

Installing package into ‘C:/Users/stu/Documents/R/win-library/3.0’

(as ‘lib’ is unspecified)

also installing the dependencies ‘RJSONIO’, ‘maps’, ‘RgoogleMaps’, ‘png’, ‘rjson’, ‘mapproj’


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/RJSONIO_1.0-3.zip'

Content type 'application/zip' length 1228802 bytes (1.2 Mb)

opened URL

downloaded 1.2 Mb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/maps_2.3-6.zip'

Content type 'application/zip' length 2073491 bytes (2.0 Mb)

opened URL

downloaded 2.0 Mb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/RgoogleMaps_1.2.0.5.zip'

Content type 'application/zip' length 468835 bytes (457 Kb)

opened URL

downloaded 457 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/png_0.1-7.zip'

Content type 'application/zip' length 290586 bytes (283 Kb)

opened URL

downloaded 283 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/rjson_0.2.13.zip'

Content type 'application/zip' length 492273 bytes (480 Kb)

opened URL

downloaded 480 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/mapproj_1.2-2.zip'

Content type 'application/zip' length 81016 bytes (79 Kb)

opened URL

downloaded 79 Kb


trying URL 'http://cran.nexr.com/bin/windows/contrib/3.0/ggmap_2.3.zip'

Content type 'application/zip' length 4529131 bytes (4.3 Mb)

opened URL

downloaded 4.3 Mb


package ‘RJSONIO’ successfully unpacked and MD5 sums checked

package ‘maps’ successfully unpacked and MD5 sums checked

package ‘RgoogleMaps’ successfully unpacked and MD5 sums checked

package ‘png’ successfully unpacked and MD5 sums checked

package ‘rjson’ successfully unpacked and MD5 sums checked

package ‘mapproj’ successfully unpacked and MD5 sums checked

package ‘ggmap’ successfully unpacked and MD5 sums checked


The downloaded binary packages are in

        C:\Users\stu\AppData\Local\Temp\RtmpueT0jG\downloaded_packages

> library(ggmap)


> cent <- c(mean(wifi_new$LON),mean(wifi_new$LAT))

> bmap <- ggmap(get_navermap(center = cent, level = 6, baselayer = "default", overlayer = c("anno_satellite"), marker = data.frame(cent[1], cent[2]), key = "c75a09166a38196955adee04d351bf8", uri = "www-rproject.org"), extent = "device", base_layer = ggplot(wifi_new, aes(x = LON, y = LAT, color = INSTL_DIV)))

> bmap + geom_point() + geom_density2d() + facet_wrap(~INSTL_DIV)
ggplot(wifi_new, aes(CATEGORY)) + geom_bar(aes(fill = INSTL_DIV))

> ggplot(wifi_new, aes(INSTL_DIV)) + geom_bar(aes(fill = CATEGORY))


반응형