Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
99 views

Introduction To The R Project For Statistical Computing: Stefano CASALEGNO, PH.D

T

Uploaded by

Kikin Nerchan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views

Introduction To The R Project For Statistical Computing: Stefano CASALEGNO, PH.D

T

Uploaded by

Kikin Nerchan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

OS Tools for Spatial Ecological modeling

 University of Basilicata, Italy – May 2010

Introduction to the 
R Project for Statistical Computing

Stefano CASALEGNO, Ph.D.

info@spatial.ecology.net www.spatial-ecology.net
Topics for this lecture
1. Introducing the R Project for Statistical
Computing: what and why?

2. Getting help: ressources for learning R

3. Applications: Using R for Spatial


Ecological modelling

4. Editing scripts with KATE

info@spatial.ecology.net www.spatial-ecology.net
1. GENERAL INTRODUCTION

The R Project for Statistical 
Computing: 
what and why?

www.spatial-ecology.net
What ?
R is a language and environment for statistical 
computing and graphics. 

It is a GNU OS project               :  open source free 
software, a mass collaboration project

R is based and similar to the S language and 
environment  → developed at Bell Laboratories (formerly 
AT&T) by John Chambers and colleagues. (the same group 
that developed C and UNIX©)
1. R introduction www.spatial-ecology.net
Software or Environment ?

 Many users think of R as a statistics system. 
We prefer to think of it of an environment within 
which statistical techniques are implemented. 

 R has its own LaTeX­like documentation 
format, which is used to supply comprehensive 
documentation, both on­line in a number of 
formats and in hardcopy. 

1. R introduction www.spatial-ecology.net
The R environment

The term "environment" is intended to 
characterize        as a fully planned and 
coherent system, rather than an incremental 
accretion of very specific and inflexible tools, as 
is frequently the case with other data analysis 
software.
R is an integrated suite of software facilities for 
data manipulation, calculation and graphical 
display. 

1. R introduction www.spatial-ecology.net
What does the R environment includes ?

 an effective data handling and storage facility,
 a suite of operators for calculations on arrays, in 
particular matrices,
  a large, coherent, integrated collection of intermediate 
tools for data analysis,
 graphical facilities for data analysis and display either 
on­screen or on hardcopy, and
 a well­developed, simple and effective programming 
language which includes conditionals, loops, user­
defined recursive functions and input and output 
facilities. 
1. R introduction www.spatial-ecology.net
WHY ?
Peculiarity

In S a statistical analysis is normally done as a 
series of steps, with intermediate results being 
stored in objects.   
Thus whereas SAS and SPSS will give copious 
output from a regression or discriminant 
analysis,
R will give minimal output and store the results in 
a fit object for subsequent interrogation by 
further R functions.

1. R introduction www.spatial-ecology.net
Advantages of 

 FREE There are no restrictions on access or use.
 Scientifically robust It is the product of 
international collaboration between top 
computational statisticians and computer language 
designers
 It runs on almost all operating systems 
 It allows statistical analysis and modelling of high 
sophistication: you are not limited to one method 
of accomplishing a given computation or graphical 
presentation
1. R introduction www.spatial-ecology.net
Advantages of             2 

 It can work on objects of unlimited size and 
complexity (cluster processing)
 Exchange data (csv, Gdal) and work environment 
( shell / GRASS) 
 It is supported by comprehensive online technical 
documentation and user­contributed community 
 Repetitive functions ”scripts”
 Published and available source codes

1. R introduction www.spatial-ecology.net
Disadvantagtes of              

 Command line
 Learn the S language
 Approach a new way of thinking about data, as 
objects each with its type, which in turn supports a 
set of methods.
 R works on Random Access Memory          
 RAM is a type of physical memory that can be read 
from and written to.

1. R introduction www.spatial-ecology.net
2. Resources for learning 

http://www.r­project.org/
 Introductions and tutorials
 Textbooks, manuals
 Web
 R News, Mailing lists, user’s conference
... R help 

2. Learning R www.spatial-ecology.net
Introductions and tutorials 
Venables, W. N. ; Smith, D. M. ; R Development Core Team, 2007. An 
Introduction to  R (Notes on R: A Programming Environment for Data 
Analysis and Graphics), Version  2.5.0 (2007­04­23). ISBN 3­900051­
12­7
  http://www.cran.r­project.org 

Hornik, K. 2007. R FAQ: Frequently Asked Questions on R. Version 
2.5.2007­04­23.  ISBN 3­900051­08­9
  
Rossiter, D.G., 2007. Introduction to the R Project for Statistical 
Computing for use at ITC. Revision 2.95. International Institute for 
Geo­information Science & Earth  Observation (ITC), Enschede (NL), 
129 pp.
http://www.itc.nl/personal/rossiter/teach/R/RIntro_ITC.pdf

2. Learning R www.spatial-ecology.net
text books 

Introductory Statistics with R. Dalgaard, P. 2002. Springer 
Verlag
Venables, W. N. & Ripley, B. D. 2002. Modern applied 
statistics with S. New York: Springer­Verlag, 4th edition  
A Handbook of Statistical Analyses Using R, Brian S. Everitt, 
Torsten Hothorn. 2006 Chapman & Hall.
A Practical Guide to Ecological Modelling: Using R as a 
Simulation Platform. Karline Soetaert, Peter M.J. Herman. 
2008. Springer 
Data Manipulation with R, Phil Spector. 2009. Springer.

2. Learning R www.spatial-ecology.net
Web

Wikipedia on R http://wiki.r­project.org/rwiki/doku.php

Help at UCLA http://www.ats.ucla.edu/stat/r/

help on packages http://astrostatistics.psu.edu/datasets/R/html/index.html

Ecological models and data in R, princeton University
http://www.zoology.ufl.edu/bolker/emdbook/

R seek function http://www.rseek.org/ 

multi­site search engine http://www.dangoldstein.com/search_r.html

2. Learning R www.spatial-ecology.net
R News, Mailing lists, user’s conference

● MAILING LIST: http://www.r­project.org/mail.html

R­sig­geo: R Special Interest Group on using Geographical data and 
Mapping https://stat.ethz.ch/mailman/listinfo/r­sig­geo

Help in spanish
https://stat.ethz.ch/mailman/listinfo/r­help­es

● NEWS LETTER 
http://cran.r­project.org/doc/Rnews/Rnews_2001­3.pdf

● CONFERENCES
http://www2.agrocampus­ouest.fr/math/useR­2009/

2. Learning R www.spatial-ecology.net
3. APPLICATION

Using           for 
Spatial Ecological modelling
packages

 Basic package of R environment, 8 “standard” 
packages 
 Packages includes: functions / data / examples / manuals

 Packages Internet sites 

http://cran.r­project.org

3. R spatial www.spatial-ecology.net
packages

3. R spatial www.spatial-ecology.net
Spatial data and 

 R has dedicated data structures and methods 
for specific kinds of data (e.g. time series data, 
spatial data, ecological modelling)

 A large number of packages provide spatial 
statistical methods or interfaces to GIS, and 
many of them provide data structures and e.g. 
plotting methods for spatial data.  

3. R spatial www.spatial-ecology.net
Editing          scripts 

using KATE 
KDE Advanced Text Editor

3. R and Kate www.spatial-ecology.net


Editing          scripts 
Many editors exists for scripting in different
programming languages, for instance...
http://www.activestate.com/komodo_edit/
http://www.gnu.org/software/emacs/
..

Editors can help programming with syntax


highlighting, tight integration with the console
commands, extensive help and more options.

3. R and Kate www.spatial-ecology.net


KATE as editor for        scripting
Kate (K Desktop Environment ) is an
advanced text editor.
http://kate­editor.org/
An easy tool for helping in scripting in R  
KDE is a network transparent contemporary desktop
environment for UNIX workstations. KDE seeks to fulfill the
need for an easy to use desktop for UNIX workstations     
 
 script can run it with the source method
 commands can be pasted into the R
console
3. R and Kate www.spatial-ecology.net
                     hands on 
  Learning and discovering R by practicing

open KATE and edit


~/ost4sem/exercise/basic_r/basic_R.R

www.spatial-ecology.net

You might also like