R 2 2017 Email: gito@eco.u-toyama.ac.jp October 16, 2017
Outline 1 ( ) 2 R RStudio 3 4 R (Toyama/NIHU) R October 16, 2017 1 / 34
R RStudio, R PC ( ) ( ) (Toyama/NIHU) R October 16, 2017 2 / 34
R ( ) R ( ) (Toyama/NIHU) R October 16, 2017 3 / 34
PC ( ) PC LAN ( 2 ) (1) R ( ) (2) ( ) (3) 3 ( ) (Toyama/NIHU) R October 16, 2017 4 / 34
10/30 (Mon.) 1/9 (Tue.) (Toyama/NIHU) R October 16, 2017 5 / 34
Gelman, A & J Hill. 2007. Data analysis using regression and multilevel/hierarchical models. Cambridge: Cambridge University Press 2016 R Imai, K. 2017. Quantitative social science: An introduction. Princeton, NJ: Princeton University Press ( 12 ) ( ) (Toyama/NIHU) R October 16, 2017 6 / 34
R URL: http://cfes-project.eco.u-toyama.ac.jp/education/education_ 2017/r_2017/ 19:00 (Toyama/NIHU) R October 16, 2017 7 / 34
(10/16) 10/9 (Mon.) ( ) 10/16 (Mon.) ( PC) R, RStudio OS Linux, macos, Windows Command + S, Command + Shift + K (macos), Control + C, Control + Shift + N (Windows) OS ( ) (Toyama/NIHU) R October 16, 2017 8 / 34
R 2 1 source 2 1 (Homebrew, macpors ) 2 https://www.r-project.org 3 Download R CRAN (Comprehensive R Archive Network) 4 0-Cloud ( ) ( ) (Toyama/NIHU) R October 16, 2017 9 / 34
https://www.r-project.org (Toyama/NIHU) R October 16, 2017 10 / 34
Download R (Toyama/NIHU) R October 16, 2017 11 / 34
(Toyama/NIHU) R October 16, 2017 12 / 34
R CRAN 1 OS 2 R (Toyama/NIHU) R October 16, 2017 13 / 34
RStudio R Studio R IDE ( ) R + α (e.g., ) R RStudio Emacs, Sublime Text ( R ) (Toyama/NIHU) R October 16, 2017 14 / 34
RStudio 1 https://www.rstudio.com 2 Download RStudio 3 RStudio Desktop Open Source License Download 4 Installers for Supported Platforms OS 5 (Toyama/NIHU) R October 16, 2017 15 / 34
https://www.rstudio.com (Toyama/NIHU) R October 16, 2017 16 / 34
RStudio Desktop Open Source License (Toyama/NIHU) R October 16, 2017 17 / 34
Installers for Supported Platforms (Toyama/NIHU) R October 16, 2017 18 / 34
R R RStudio +α CRAN 10,000 1 GUI ( ) ( ) 2 (Toyama/NIHU) R October 16, 2017 19 / 34
CRAN 250 200 N new packages released 150 100 50 0 2008 2010 2012 2014 2016 2018 Year Data scraped from CRANberries (http://dirk.eddelbuettel.com/cranberries/, as of October 15, 2017) (Toyama/NIHU) R October 16, 2017 20 / 34
GUI GUI RStudio 1 RStudio Tools (, ) 2 Install Packages 3 (1) Install from Repository (CRAN) (2) Install dependencies 4 Packages devt 5 devtools Install (Toyama/NIHU) R October 16, 2017 21 / 34
(Toyama/NIHU) R October 16, 2017 22 / 34
(Toyama/NIHU) R October 16, 2017 23 / 34
(Toyama/NIHU) R October 16, 2017 24 / 34
RStudio library() R 1 RStudio Console ( ) 2 lib library(d) 3 library(devtools) enter 4 ok 1 > library(devtools) (Toyama/NIHU) R October 16, 2017 25 / 34
(Toyama/NIHU) R October 16, 2017 26 / 34
(Toyama/NIHU) R October 16, 2017 27 / 34
(Toyama/NIHU) R October 16, 2017 28 / 34
( ) GUI 100 ( ) R(Studio) ( ) 1 (http://cfes-project.eco.u-toyama.ac.jp/ education/education_2017/r_2017/) 2 R R MARKDOWN 3 install_packages_fall_1016_2017.r.r (.r) R (Toyama/NIHU) R October 16, 2017 29 / 34
( ) 1 install_packages_fall_1016_2017.r RStudio R RStudio.R RStudio 2 RStudio (preferences) RStudio (Toyama/NIHU) R October 16, 2017 30 / 34
RStudio (Toyama/NIHU) R October 16, 2017 31 / 34
( ) 1 install.packages("devtools", dependencies = TRUE) 1 (11 ) 2 3 command + enter (Mac) or control + enter (Windows) 1 devtools command + enter RStudio RStudio (2 3 ) (Toyama/NIHU) R October 16, 2017 32 / 34
( ) 1 12 2 command + enter (M) or control + enter (W) (Toyama/NIHU) R October 16, 2017 33 / 34
R 1 2 R R R (Toyama/NIHU) R October 16, 2017 34 / 34