Sequential data analysis
Sequential data analysis An introduction to R
Gilbert Ritschard
Department of Econometrics and Laboratory of Demography, University of Geneva http://mephisto.unige.ch/biomining
APA-ATI Workshop on Exploratory Data Mining University of Southern California, Los Angeles, CA, July 2009
23/7/2009gr 1/64 Sequential data analysis
Outline
1
Introduction
2
Installing and launching R
3
Objects and operators
4
Elements of statistical modeling
5
Growing trees: rpart and party
6
Custom functions and programming
23/7/2009gr 2/64 Sequential data analysis Introduction
R
R is: Software environment for statistical computing and graphics Based on the S language (as is S-PLUS) Freely distributed under GPL licence Available for any platform: Windows/Mac/Linux/Unix Easily extensible with numerous contributed modules
23/7/2009gr 4/64 Sequential data analysis Installing and launching R
Installation
R and the modules can be downloaded from the CRAN http://cran.r-project.org By default, no GUI is proposed under Linux. Under Windows and MacOSX, the basic GUI remains limited. ... but try Rcmdr (can be download from the CRAN)
23/7/2009gr 6/64 Sequential data analysis Installing and launching R
First steps in R
Four possibilities to send commands to R
1 Type commands in the R Console. 2 The script editor -> File/New script (only Windows/Mac) 3 The Rcmd module 4 Use a text editor with R support (Tinn-R, WinEdt, etc.)
In addition, you can also use your preferred text editor and copy-paste the commands into the R Console,
23/7/2009gr 7/64 Sequential data analysis Objects and operators Introduction to R objects
Objects
R works with objects Assigning a value to an object ‘a’
R> a <- 50
Operation on an object
R> a/50 [1] 1
Case-sensitive: a = A
R> A/50 Error: object "A" not found
23/7/2009gr 10/64
1