Introduction to the R Project for Statistical Computing for this lecture ... The R Project for Statistical Computing: ... Geo-informationGScienceGKGEarthGGObservationG(ITC) ...
Post on 19-Mar-2018
223 Views
Preview:
Transcript
Master GIS Remote Sensing University of Saragoza Spain
Introduction to the
R Project for Statistical Computing
March 2010
Stefano CASALEGNO, Ph.D.
www.spatial-ecology.netinfo@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
www.spatial-ecology.netinfo@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©)
www.spatial-ecology.net1. R introduction
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 LaTeXlike documentation format, which is used to supply comprehensive documentation, both online in a number of formats and in hardcopy.
www.spatial-ecology.net1. R introduction
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.
www.spatial-ecology.net1. R introduction
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 onscreen or on hardcopy, and
a welldeveloped, simple and effective programming language which includes conditionals, loops, userdefined recursive functions and input and output facilities.
www.spatial-ecology.net1. R introduction
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.
www.spatial-ecology.net1. R introduction
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
Advantages of
www.spatial-ecology.net1. R introduction
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 usercontributed community
Repetitive functions ”scripts” Published and available source codes
Advantages of 2
www.spatial-ecology.net1. R introduction
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.
Disadvantagtes of
www.spatial-ecology.net1. R introduction
2. Resources for learning
http://www.rproject.org/ Introductions and tutorials Textbooks, manuals Web R News, Mailing lists, user’s conference
... R help
www.spatial-ecology.net2. Learning R
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 (20070423). ISBN 3900051127 http://www.cran.rproject.org
Hornik, K. 2007. R FAQ: Frequently Asked Questions on R. Version 2.5.20070423. ISBN 3900051089 Rossiter, D.G., 2007. Introduction to the R Project for Statistical Computing for use at ITC. Revision 2.95. International Institute for Geoinformation Science & Earth Observation (ITC), Enschede (NL), 129 pp.http://www.itc.nl/personal/rossiter/teach/R/RIntro_ITC.pdf
www.spatial-ecology.net2. Learning R
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: SpringerVerlag, 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.
www.spatial-ecology.net2. Learning R
Web
Wikipedia on R http://wiki.rproject.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 Universityhttp://www.zoology.ufl.edu/bolker/emdbook/
R seek function http://www.rseek.org/
multisite search engine http://www.dangoldstein.com/search_r.html
www.spatial-ecology.net2. Learning R
R News, Mailing lists, user’s conference
● MAILING LIST: http://www.rproject.org/mail.html
Rsiggeo: R Special Interest Group on using Geographical data and Mapping https://stat.ethz.ch/mailman/listinfo/rsiggeo
Help in spanishhttps://stat.ethz.ch/mailman/listinfo/rhelpes
● NEWS LETTER http://cran.rproject.org/doc/Rnews/Rnews_20013.pdf
● CONFERENCEShttp://www2.agrocampusouest.fr/math/useR2009/
www.spatial-ecology.net2. Learning R
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.rproject.org
www.spatial-ecology.net3. R spatial
packages
www.spatial-ecology.net3. R spatial
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.
www.spatial-ecology.net3. R spatial
Editing scripts
using KATE KDE Advanced Text Editor
www.spatial-ecology.net3. R and Kate
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.
www.spatial-ecology.net3. R and Kate
KATE as editor for scripting
Kate (K Desktop Environment ) is an advanced text editor. http://kateeditor.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
consolewww.spatial-ecology.net3. R and Kate
hands on
Learning and discovering R by practicing
open KATE and edit~/ost4sem/exercise/basic_r/basic_R.R
www.spatial-ecology.net
top related