프로그래밍 언어 R(Programming language R)
통계에 대해서는 항상 R이 빠지지 않고 등장하는데요, R이 무엇인지 알아봅시다.
R이란 무엇인가
프로그래밍 언어의 R은 통계 전산을 위한 소프트웨어 환경입니다. 통계 프로그램이나 데이터 분석을 위해 통계자들과 데이터 마이너들이 폭넓게 사용하고 있습니다.
더 자세한건 Wikipedia - R(programming language)를 클릭해서 확인해 보세요.
통계를 위한 프로그래밍 언어라는건 이제 알겠지만 실제로 어떤건지는 설치 및 예제를 돌려봅시다.
다운로드
Windows
윈도우에서 설치하려면 아래링크에서 R을 다운로드 받도록 합시다. 포스팅 작성 시점엔 3.2.0 버전이군요.
설치
다운로드 받은 파일을 설치 해봅시다.
Windows
별 것 없어요. 그냥 다음(N) 버튼을 계속 클릭해서 귀찮은 설치 마법사를 넘겨버립시다.
실행
Windows
시작메뉴에서 R를 찾아 클릭하면 RGui가 실행이 됩니다. 그리고 R Console이 자동으로 떠있네요. 아래와 같이 출력되어 있습니다.
R version 3.2.0 (2015-04-16) -- "Full of Ingredients" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: i386-w64-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.
그럼 우선 demo() 를 타이핑해서 살펴볼까요? 타이핑해서 엔터를 치면 R demos라는 윈도우가 새롭게 나타납니다.
Demos in package ‘base’: error.catching More examples on catching and handling errors is.things Explore some properties of R objects and is.FOO() functions. Not for newbies! recursion Using recursion for adaptive integration scoping An illustration of lexical scoping. ...(중략) Use ‘demo(package = .packages(all.available = TRUE))’ to list the demos in all *available* packages.
음, 마지막줄이 핵심이군요. demo(package = .packages(all.available = TRUE))를 R Console 윈도우에서 타이핑해봅시다. 이 커맨드를 통해 허용 가능한 모든 패키지의 데모 목록을 출력해준다고 하네요.
커맨드를 실행하면 R demos 윈도우가 새로 나타납니다.
...(생략) Demos in package ‘graphics’: Hershey Tables of the characters in the Hershey vector fonts Japanese Tables of the Japanese characters in the Hershey vector fonts graphics A show of some of R's graphics capabilities image The image-like graphics builtins of R persp Extended persp() examples plotmath Examples of the use of mathematics annotation ...(생략)
그럼 실제로 데모를 한번 실행 시켜 볼까요? R Console에서 demo(graphics)를 타이핑 후 실행시켜 봅시다. 뭐 하나 더 묻는데 그냥 무시하고 엔터 치시면 각종 그래픽스러운(?) 데모 화면이 계속 나와요. 위에 나온 목록을 demo에 인자로 넘겨주면 해당하는 데모 윈도우가 나타납니다.
Closing Remarks
간단하게 R 설치 및 데모까지 실행 시켜 봤습니다. :)