the r project for statistical computing - spatial-ecology · 2016-05-27 · the r project for...

20
The R Project for Statistical Computing www.r-project.org A. M. Wilson, G. Amatulli & S. Casalegno

Upload: others

Post on 04-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

The R Project for Statistical Computing

www.r-project.org

A. M. Wilson, G. Amatulli & S. Casalegno

Page 2: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

about

● GNU – Free and Open source● Data manipulation● Data analysis tools● Great Graphics● Programming language● 800+ free, user-contributed packages● A supportive and increasing user community

R is a dialect of 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©)

Page 3: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

environment

● an effective data handling and storage facility● a suite of operators for (vectorized) calculations ● a large, coherent, integrated collection of tools for data analysis● graphical capabilities (screen or hardcopy)● a well-developed, simple, and effective programming language

 which includes● conditionals● Loops● user defined recursive functions● input and output facilitiesa

Page 4: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

community

scientist, blogger, professional, hackers ...

Page 5: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Reproducible, Portable & Transparent

As a scientist, I teach my students that for doing science it is a requirement to work with open source software, because only then workflows are fully transparent and can be reproduced by other scientists without prohibitive license costs.

( Edzer Pebesma – OSGeo - Discuss)

. . . all the code and data used to recreate the Mann’s original analysis has been made available to the public [...] Since the analysis is in R, anyone can replicate the results and examine the methods. (Matthew Pocernich, R news 6/4, 10/31/06)

Page 6: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

GRAPHICS if you can imagine...

Page 7: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Spatial data in

● Packages: sp, maptools, raster

see R spatial view

SPATIAL MODELLING

Page 8: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

STATISTICAL ANALYSES OF SPATIAL DATA● ex.: SpatialPack package

assess the association between spatial process

Page 9: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Interface with other software

GRASS, QGIS and other spatial & non spatial software and libraries

Page 10: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Command line and GUI

Page 11: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Strengths & Limitations

● Just-in-time compilation: ● Slower than compiled languages (-)● Faster to compose (+) ● Many available packages (+)

● Most operations conducted in RAM● RAM can be limiting and/or expensive (-)● “Error: cannot allocate vector of size X Mb”● Various packages and clever programming can overcome this.. (+)

● Free like beer and speech! (+)

Page 12: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Parallel processing

● HPC and multi-core processors

Page 13: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

GPU processing

Page 14: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

General workflow

And example commands

Gather Clean

PrepareAnalysis

GraphicsTable

Summaries

WebsitesPresentationsManuscripts

Reports

RawData

WgetAPIs

GdalpktoolsGRASSmergeReshapeopenforismorfeo

ModelsStat functionsRandomForest

XtableTiffKnitrLaTex

Page 15: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Object based programming language

Example objects:● Matrix● Vectors● DataFrames● SpatialDataframes● Lists

Page 16: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

Based on adds-on packages

Page 17: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

On-line help

● 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

Page 18: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

More help

● 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

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

● CONFERENCEShttp://www2.agrocampus-ouest.fr/math/useR-2009/

Page 19: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

syntax

OutputName object (parameter,[option])←●

myNewMatrix matrix(data = NA, nrow = 2, ncol = 3, ←

byrow = FALSE, dimnames = NULL)

Page 20: The R Project for Statistical Computing - spatial-ecology · 2016-05-27 · The R Project for Statistical Computing  A. M. Wilson, G. Amatulli & S. Casalegno

hands on

http://spatial-ecology.net/dokuwiki/doku.php?id=wiki:r