Introduction to R Tara Jensen National Center for Atmospheric Research Boulder, Colorado USA

Slides:



Advertisements
Similar presentations
Introduction to S-Plus by Francesco Ferretti Analysis of Biological Data Course Winter term 2007 Dalhousie University.
Advertisements

Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
Introduction to Graphics in R Department of Statistical Sciences and Operations Research Computation Seminar Series Speaker: Edward Boone
® Page 1 Intel Compiler Lab – Intel Array Visualizer HDF Workshop VI December 5, 2002 John Readey
 Statistics package  Graphics package  Programming language  Can be used to share/reproduce analyses  Many new packages being created - can be downloaded.
Microsoft Office 2007: Introductory Computer Applications 11.
Word Lesson 8 Increasing Efficiency Using Word
Introduction to a language and environment for statistical computing and graphics. A tutorial by Eric Gilliland and Matt Pocernich March 29th, 2006.
Alternative text for elementary statistics –Elementary Concepts –Basic Statistics.
How to Use the R Programming Language for Statistical Analyses Part I: An Introduction to R Jennifer Urbano Blackford, Ph.D. Department of Psychiatry Kennedy.
The “R” Statistical Package Naomi Altman Dept. of Statistics PSU.
Computer Software.
Introduction to R Statistical Software Anthony (Tony) R. Olsen USEPA ORD NHEERL Western Ecology Division Corvallis, OR (541)
What is R By: Wase Siddiqui. Introduction R is a programming language which is used for statistical computing and graphics. “R is a language and environment.
Linux Operations and Administration
Operating Systems Operating System
® Page 1 Intel Compiler Lab – Intel Array Visualizer HDF Workshop VIII October 27, 2004 John Readey
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
EARTH SCIENCE MARKUP LANGUAGE “Define Once Use Anywhere” INFORMATION TECHNOLOGY AND SYSTEMS CENTER UNIVERSITY OF ALABAMA IN HUNTSVILLE.
4 1 Operating System Activities  An operating system is a type of system software that acts as the master controller for all activities that take place.
Hands-on Introduction to R. Outline R : A powerful Platform for Statistical Analysis Why bother learning R ? Data, data, data, I cannot make bricks without.
Data, graphics, and programming in R 28.1, 30.1, Daily:10:00-12:45 & 13:45-16:30 EXCEPT WED 4 th 9:00-11:45 & 12:45-15:30 Teacher: Anna Kuparinen.
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
Intro to R R is a free version of S-plus R is a free version of S-plus Can be used interactively but script or syntax files are commonly used to record.
Computer Programming for Biologists Oct 30 th – Dec 11 th, 2014 Karsten Hokamp  Fill out.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
R freeware statistics package Tara Jenson NCAR RAL JNT Tom Hopson.
Piotr Wolski Introduction to R. Topics What is R? Sample session How to install R? Minimum you have to know to work in R Data objects in R and how to.
Khoros Yongqun He Dept. of Computer Science, Virginia Tech.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
Hands-on Introduction to R. We live in oceans of data. Computers are essential to record and help analyse it. Competent scientists speak C/C++, Java,
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
R packages/libraries Data input/output Rachel Carroll Department of Public Health Sciences, MUSC Computing for Research I, Spring 2014.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Winter Semester 2014/2015 College of Engineering.
C OMPUTING E SSENTIALS Timothy J. O’Leary Linda I. O’Leary Presentations by: Fred Bounds.
1 EndNote X2 Your Bibliographic Management Tool 29 September 2009 Humanities and Social Sciences Resource Teams.
Introduction to R Introductions What is R? RStudio Layout Summary Statistics Your First R Graph 17 September 2014 Sherubtse Training.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
ElVis Improvements Summer 2008 Eric Zatz PPPL Summer Intern Mentor – Eliot Feibush August 11, 2008.
More Unix Naomi Altman. Directories Directory = folder mkdir - makes a new directory rmdir - removes an empty directory cd mydirectory - moves you into.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
M ATLAB – What Is It ? Name is from matrix laboratory Powerful tool for – Computation and visualization of engineering and science mathematics – Communication.
Introduction to CADStat. CADStat and R R is a powerful and free statistical package [
Chris Knight Beginners’ workshop.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
 CSC 215 : Procedural Programming with C C Compilers.
With the support of the LPP programme of the European Union 1 This project has been funded with support from the European Commission. This publication.
Introduction to R Dr. Satish Nargundkar. What is R? R is a free software environment for statistical computing and graphics. It compiles and runs on a.
Development Environment
CST 1101 Problem Solving Using Computers
R Brown-Bag Seminar 2.1 Topic: Introduction to R Presenter: Faith Musili ICRAF-Geoscience Lab.
Nature & Types of Software
Release Numbers MATLAB is updated regularly
Getting Started with R.
Weather Forecast Verification Using
MATLAB Basics Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
Adventures in teaching and learning data analysis with R
R Programming.
Outline Matlab tutorial How to start and exit Matlab Matlab basics.
Introduction to R.
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
MATLAB – What Is It ? Name is from matrix laboratory Powerful tool for
Installing Packages Introduction to R, Part II
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
Stata Basic Course.
> Introduction to Nelson Rios, Tulane University
Presentation transcript:

Introduction to R Tara Jensen National Center for Atmospheric Research Boulder, Colorado USA

R Exercises  Find sample data and R scripts at:  ftp://ftp.ncmrwf.gov.in/pub/outgoing/rag hu/6WVMW/Tutorial/Day1/R-tutorial ftp://ftp.ncmrwf.gov.in/pub/outgoing/rag hu/6WVMW/Tutorial/Day1/R-tutorial  Download to directory on your computer  Start R  Open intro2R.2014wmo.R

What is R?  A statistical programming and graphics language  In part, developed from the S Programming Language from Bell Labs (John Chambers)  Created to:  Allow rapid development of methods for use in different types of data.  Require small amounts of system resources

Why R?  R ~ the dominant language in the statistical research community.  R is Open Source and free.  Runs on most operating systems  Nearly 2,400 packages contributed.  Packages and applications in nearly every field of science, business and economics.  See R Notes, R Journal and Journal of Statistical Software.  More than 100 books with accompanying code  Very large, active user base.  Many default parameters are chosen, but users retain complete control.

Why not R?  NCL, IDL, Matlab, SAS, … are all viable alternatives to R. If you are a part of an active community of researchers using another language, do likewise.  R may be limited by memory. For verification of large gridded datasets – consider using Model Evaluation Tools (MET)  R is does not produce a compiled executable so may not be desirable to some operational centers

The R Community  Developers  R Core Group (20 members), only 2 have left since 1997  Major update in April/October (freeze dates, beta versions, bug tracking,...)  Mailing lists  Help list ~ 150 messages/day, archived, searchable.   5 International Conferences, 2 US, 1 China

Everything about R is at Source code Binary compilations (Windows, Mac OS, Linux Documentation ( Main documents, plus numerous contributed. Some in foreign languages.) Newsletter (replaced by R Journal.) Mailing list (Several search engines) Packages on every topic imaginable Wiki with examples Reference list of books using R. ( more than 100) Task Manager

Use R with scripts  In Linux - Emacs Speaks Statistics  Provides syntax-based  Object name completion  Key stroke short cuts  Command history  Alt-x R to invoke R with Xemacs.  In Windows, use editor  Added GUI features  R sends a line or highlighted section into R.  Install package with GUIs  Save graphics by point and click.  Mac OS  Similar to Windows with advantages of system calls.

R Coding principles  Make verification code transparent and easy to read  Comment and document liberally  Archive your code  Share your code  Label and save your data  Share your data

Packages in R  Contributed by people world wide.  Allow scientists or statisticians to push their ideas.  Apply and extend R capabilities to meet the needs of specific communities.  Accompany many statistical textbooks  Accompany applied articles (Adrian Raftery, Doug Nychka, Tilman Gneiting, Barbara Casati, Matt Briggs)

R Packages  Mirror must be selected  Packages -> Set CRAN mirror  chooseCRANmirror()  Packages must be installed to call  Packages -> Install Package(s)  install.packages(c("package 1","package 2","package 3", etc.))  Packages must be loaded (aka called into use)  Packages -> Load Package(s)  library(“package1”)  library(“package2”) etc…  Base packages are installed by default  To see what packages are installed  Packages -> Load Package(s)  installed.packages(.Library, priority="package 1")  To see what packages are installed  remove.packages(package1,package2, lib=file.path("path to library" ) Windows or Mac Linux

A sample of useful packages  verification  fields (spatial stats)  radiosondes  extRemes  BMA(Bayesian Model Averaging)  BMAensemble  circular  Rsqlite  SpatialVx  Rgis, spatstat (GIS)  ncdf ( support for netcdf files )  rgdal (support for grib1 files)  rNOMADS (support for grib2 files archived by NCEP)  Rcolorbrewer  randomForests

Very useful functions in R  q( ) – allows you to exit R – you will then be asked if you would like to save your workspace  ls( ) – shows you the objects in your workspace  rm( ) – allows you to remove an object  system( ) – allows you to call system command from R  help(package or function) – brings up help page  ?(package or function) – brings up a help page  read.fwf – read fixed width format data  read.table – read text file with delimiters

More useful functions  aggregate - applies a function to groups of data subset by categories.  apply - incredibly efficient in avoiding loops. Applies functions across dimensions of arrays.  %in% - returns logical showing which elements in A are in B. (e.g A%in%B)  table – create contingency table counts.  boot – apply bootstrap function correctly  par – control everything in a graph  pairs – the most under utilized plot – plots a matrix of 4 columns in a 4x4 plot layout  xyplot (in the lattice package) slightly advance graphic techniques

R Exercises  Find sample data and R scripts at:  ftp://ftp.ncmrwf.gov.in/pub/outgoing/raghu/6 WVMW/Tutorial/Day1/R-tutorial  Download to directory on your computer  Start R  Click on on your desktop  type R at command line  Open intro2R.2014wmo.R  Select File -> Open Script -> select intro2R.2014wmo.R  Open in another window using your favorite editory Windows or Mac Linux