30
Introduction to Biodiversity Informatics Training Workshop Boulder, CO >

Introduction to

  • Upload
    kerri

  • View
    19

  • Download
    0

Embed Size (px)

DESCRIPTION

Introduction to. >. Biodiversity Informatics Training Workshop Boulder, CO. What is R. Open source interpreted programming language and development environment Initially release in 1993 Influenced by the S programming language Focus on statistics, data analysis & graphics - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction to

Introduction toBiodiversity Informatics Training Workshop

Boulder, CO

>

Page 2: Introduction to

What is R

• Open source interpreted programming language and development environment

• Initially release in 1993• Influenced by the S programming language• Focus on statistics, data analysis & graphics• Extensible via user contributed packages

Page 3: Introduction to

Why R?

• Reproducible, RepeatableTherefore a perfect tool for science

• Method to track data and analytic flowTherefore a perfect tool for scientists

Page 4: Introduction to
Page 5: Introduction to
Page 6: Introduction to

Why Open?

Page 7: Introduction to
Page 8: Introduction to
Page 9: Introduction to
Page 10: Introduction to

Rasters: GeoTiff, .ASC, .BIL,

Vectors: Shapefiles

{dismo}, {rgdal}, {rVertnet}

• GetData• Prepare• Filter• Subset• Analyse• Model

• Map Data

• Derive surfaces

• Subset• Create

visuals

R & QGIS Integration

Page 11: Introduction to

Getting

• www.r-project.org• Available for Windows, Macintosh, Linux & as

Source Code• Current release (14 June 2013): R 3.0.1

Page 12: Introduction to

RGui

Page 13: Introduction to
Page 14: Introduction to

Object-based functional language

• What that means to users:Commands have three parts: arguments, body and its environment. A function is invoked by its name, followed by arguments, which can be named, positional or have defaults if omitted

myvariable <- read.table(x, file = ”data.csv”, sep = ”,”)

Page 15: Introduction to

Objects

• Used to store values• Case sensitive• Named with alphanumeric characters• Cannot start with a number• Persistent until reassigned or removed from

objects list. User rm(obj_name) to remove.• Values can be assigned to variables via <- or = • Use objects() or ls() to view list of objects in the

current environment.

Page 16: Introduction to

Getting Help

• ?fxn or help(fxn)

> ?round

Page 17: Introduction to

Extending R• Via user-created packages available from

repositories– CRAN (Comprehensive R Archive Network)– Bioconductor

Page 18: Introduction to

Installing and using Packages• Over 4,600 packages available. • Package: maps

– Draw lines and polygons as specified by a map database.• Package: mapproj

– Converts latitude and longitude into projected coordinates. Required by maps package, if we want to use projections other than default (rectangular).

• Package: maptools– Set of tools for manipulating and reading geographic data, in particular

ESRI shapefiles. Also installs package sp.• Package: sp

– A package providing classes and methods for spatial data: points, lines, polygons and grids

Page 19: Introduction to

Bonne equal-area projection

Rectangular projection

Using Packages

Page 20: Introduction to

U.S. Census State Boundaries

Results fromGeoreferencing

Page 21: Introduction to

Filtering Data

StateProvince==“Missouri”

Use logical operators in filter expression: ==, >, <, <=, >=, <>

Page 22: Introduction to

Editing records in your data frame

or

Page 23: Introduction to

FishNet 2 Collaborative Georeferencing Project

• http://geolocate.fishnet2.net/workflow.html

Page 24: Introduction to
Page 25: Introduction to
Page 26: Introduction to

More Information

http://cran.r-project.org/doc/manuals/R-intro.pdf

Page 27: Introduction to

for Loops

Syntax: for (name in expr1) expr2

Page 28: Introduction to

Breaking out of Loops

next can be used to discontinue the rest of a particular cycle and skip to the next iteration in the loop

Page 29: Introduction to

while Loops

Syntax: while (condition) expr

Page 30: Introduction to

repeat Loops

Syntax: repeat expr

Expression is repeated until break is called