Intro to R. Professor Clayton Nall h/t Thomas Leeper, Ph.D. (University of Aarhus) and Teppei Yamamoto, Ph.D. (MIT) June 26, 2014

Similar documents
A Year of Tips for Communication Success

Content Part 2 Users manual... 4

Instructor Guide to EHR Go

Making YouTube Videos Accessible through Closed Captioning and Community Contributions

Symantec ESM Agent for IBM AS/400 Installation Guide. Version: 6.5

Hour 2: lm (regression), plot (scatterplots), cooks.distance and resid (diagnostics) Stat 302, Winter 2016 SFU, Week 3, Hour 1, Page 1

THEORIES OF COUNSELING AND PSYCHOTHERAPY: A CASE APPROACH (3RD EDITION) BY NANCY L. MURDOCK

Study on Gender in Physics

Let s get started with the OneTouch Reveal web app

Lesson 3 Profex Graphical User Interface for BGMN and Fullprof

Use the following checklist to ensure that video captions are compliant with accessibility guidelines.

Selected Proceedings of ALDAcon SORENSON IP RELAY Presenter: MICHAEL JORDAN

Logic Model. When do you create a Logic Model? Create your LM at the beginning of an evaluation and review and update it periodically.

TMWSuite. DAT Interactive interface

Just use the link above to register. Then start with the next slide.

Computer Science 101 Project 2: Predator Prey Model

Data Management & Scoring Manual

THE GALLAUDET DICTIONARY OF AMERICAN SIGN LANGUAGE FROM HARRIS COMMUNICATIONS

Two-Way Independent ANOVA

IMPaLA tutorial.

Review of Veterinary Epidemiologic Research by Dohoo, Martin, and Stryhn

Exercise Pro Getting Started Guide

THE ANALYTICS EDGE. Intelligence, Happiness, and Health x The Analytics Edge

VMMC Installation Guide (Windows NT) Version 2.0

Introduction to SPSS S0

AN INTRODUCTION TO THE PHYSIOLOGY OF HEARING BY JAMES O. PICKLES

DON'T JUST SIGN... COMMUNICATE!: A STUDENT'S GUIDE TO MASTERING AMERICAN SIGN LANGUAGE GRAMMAR BY MICHELLE JAY

Inventions on expressing emotions In Graphical User Interface

MUSIC 208 Homework 7-8

INSTANT RUBYMINE ASSIMILATION BY DAVE JONES DOWNLOAD EBOOK : INSTANT RUBYMINE ASSIMILATION BY DAVE JONES PDF

Run Time Tester Requirements Document

EXPERT INTERVIEW Diabetes Distress:

PSYCHOLOGY IN YOUR LIFE (SECOND EDITION) BY SARAH GRISON, TODD HEATHERTON, MICHAEL GAZZANIGA

MyDispense OTC exercise Guide

OpenCount 100 Call Data Recording in the OpenCom 100 Communications System

Author : admin. In this post, I will shortly explain how a picture of a command running in console or terminal in GNU / Linux can be made

Speech Recognition. Setup Guide for Win 7. Debbie Hebert, PT, ATP Central AT Services

Assistive Technologies

User Guide V: 3.0, August 2017

The emotional side of diabetes

mehealth for ADHD Parent Manual

Our theme today is It s About People. If we are going to understand how to make our teams work this way, we have to better understand who we are.

GLOBAL INNOVATION BY DESIGN

Health informatics Digital imaging and communication in medicine (DICOM) including workflow and data management

MATRIX ANALYSIS FRAMED STRUCTURES BY WILLIAM WEAVER, JAMES M. GERE

THERAPY MANAGEMENT SOFTWARE FOR DIABETES. User Guide

Kinomap Trainer app is set for fitness machines including exercise bikes, ellipticals and cross trainers, treadmills and rowers.

Intro to HCI / Why is Design Hard?

POWERED BY CROSSFIT PETRAM

CSDplotter user guide Klas H. Pettersen

ProScript User Guide. Pharmacy Access Medicines Manager

Activant Acclaim. Using smit and p21adm. AIX suite: course 3 of 3

Chapter 18: Categorical data

Dear Members of CoDA,

Chapter 3 Software Packages to Install How to Set Up Python Eclipse How to Set Up Eclipse... 42

Getting the Design Right Daniel Luna, Mackenzie Miller, Saloni Parikh, Ben Tebbs

Sanako Lab 100 STS USER GUIDE

University of Toronto. Final Report. myacl. Student: Alaa Abdulaal Pirave Eahalaivan Nirtal Shah. Professor: Jonathan Rose

Proteome Discoverer Version 1.3

Benefits: It's all about the Features Content:

Clay Tablet Connector for hybris. User Guide. Version 1.5.0

ReSound Forte and ReSound Smart 3D App For Android Users Frequently Asked Questions

Getting Started for Windows

SAMPLING ERROI~ IN THE INTEGRATED sysrem FOR SURVEY ANALYSIS (ISSA)

POST INSTALLATION STEPS FOR SHORETEL CONNECT, SHORETEL COMMUNICATOR AND FAQ

PEER REVIEW HISTORY ARTICLE DETAILS VERSION 1 - REVIEW. Ball State University

Building Friendships: Avoid Discounting

Choose a fertility clinic: update

VIEW AS Fit Page! PRESS PgDn to advance slides!

SANAKO Lab 100 STS USER GUIDE

Research has long suggested that 21 days is all it takes to start a new habit.

SAGE. Nick Beard Vice President, IDX Systems Corp.

Thank you for choosing Healing Touch Physical Therapy.

COGS 121 HCI Programming Studio. Week 03

CSE 118/218 Final Presentation. Team 2 Dreams and Aspirations

SleepImage Website Instructions for Use

EDUCATIONAL TECHNOLOGY MAKING AUDIO AND VIDEO ACCESSIBLE

GridMAT-MD: A Grid-based Membrane Analysis Tool for use with Molecular Dynamics

Introduction. Preliminary POV. Additional Needfinding Results. CS Behavioral Change Studio ASSIGNMENT 2 POVS and Experience Prototypes

SPSS Correlation/Regression

Intro to Diabetes J. MacLaren 09/2009

Video Captioning Basics

Corporate Online. Using Term Deposits

Assessing Modes of Interaction

BROOK'S CLINICAL PEDIATRIC ENDOCRINOLOGY FROM WILEY- BLACKWELL

TKT CLIL LESSON PLAN

Information on ADHD for Children, Question and Answer - long version

Video Captioning Workflow and Style Guide Overview

NEXTGEN ICD10 TIPS DEMONSTRATION

DTI C TheUniversityof Georgia

Test-Driven Development Exposed Growing Complex Software One Test at a Time

National Inspection of services that support looked after children and care leavers

EHS QUICKSTART GUIDE RTLAB / CPU SECTION EFPGASIM TOOLBOX.

IPUMS â CPS Extraction and Analysis

Forming a Friends of the Park Group

"MMR vaccine controversy." wikipedia. N.p., 17 Mar Web. 22 Mar

What is Executive Coaching? Session 1 March 27, 2018

Transcription:

Intro to R Professor Clayton Nall h/t Thomas Leeper, Ph.D. (University of Aarhus) and Teppei Yamamoto, Ph.D. (MIT) June 26, 2014 Nall Intro to R 1 / 44

Nall Intro to R 2 / 44

1 Opportunities 2 Challenges 3 The R Language Nall Intro to R 3 / 44

Opportunities 1 Opportunities 2 Challenges 3 The R Language Nall Intro to R 4 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 5 / 44

Opportunities What can you do with R? Everything Everything Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything Everything Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything: Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything: Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything: Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything: Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything: Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities What can you do with R? Everything But seriously... Everything: Statistical analysis (including Monte Carlo simulation) Text processing Online data (web scraping, calling online archives) High-level visualization Maps and geographic data Calling other software and services to do jobs (e.g., SQL, Google Maps) Nall Intro to R 6 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 7 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 7 / 44

Opportunities Why is R good for science? Scripting Reproducible research tools Scripting Report generation Data sharing Nall Intro to R 8 / 44

Opportunities Reproducible Research All data and replication code is public All results come directly from open-source code You write a script, you don t point and click, so you can trace your steps This makes changes and collaboration easier Nall Intro to R 9 / 44

Opportunities Workflow for Scientific Replication Store data in perpetually readable formats (usually ASCII) Write a complete analysis script Script should run analysis and output results Reports should import results directly Share data, script, and codebooks Nall Intro to R 10 / 44

Opportunities Questions so far? Nall Intro to R 11 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 12 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 12 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities What is everyone else doing? Nall Intro to R 13 / 44

Opportunities Impact of popularity Huge community support Cutting edge techniques Versatile New packages and approaches constantly being developed Nall Intro to R 14 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 15 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 15 / 44

Opportunities R is FREE No licensing hassles, all packages and downloads FREE Open source. Reverse compatibility always possible. Independence from decisions at IBM, STATA corporate HQ Individual control Nall Intro to R 16 / 44

Opportunities R is FREE No licensing hassles, all packages and downloads FREE Open source. Reverse compatibility always possible. Independence from decisions at IBM, STATA corporate HQ Individual control Nall Intro to R 16 / 44

Opportunities R is FREE No licensing hassles, all packages and downloads FREE Open source. Reverse compatibility always possible. Independence from decisions at IBM, STATA corporate HQ Individual control Nall Intro to R 16 / 44

Opportunities R is FREE No licensing hassles, all packages and downloads FREE Open source. Reverse compatibility always possible. Independence from decisions at IBM, STATA corporate HQ Individual control Nall Intro to R 16 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 17 / 44

Opportunities Why should you use R? Because you want to do more Because you can create a better scientific workflow Because everyone else is doing it Because it is free Because R is beautiful Nall Intro to R 17 / 44

Graphs are beautiful Opportunities You can make superb graphics in R Nall Intro to R 18 / 44

Opportunities Nall Intro to R 19 / 44

Opportunities Nall Intro to R 19 / 44

Opportunities Nall Intro to R 19 / 44

Opportunities Nall Intro to R 19 / 44

Opportunities Nall Intro to R 19 / 44

Opportunities Questions so far? Nall Intro to R 20 / 44

Challenges 1 Opportunities 2 Challenges 3 The R Language Nall Intro to R 21 / 44

Challenges Frustrations you will have with R No graphical user interface (GUI) Lots of add-on packages (lightweight base software) Mistype or misspell commands and you re usually short of luck Missing data handling can be confusing Cryptic error messages Nall Intro to R 22 / 44

Challenges Frustrations you will have with R No graphical user interface (GUI) Lots of add-on packages (lightweight base software) Mistype or misspell commands and you re usually short of luck Missing data handling can be confusing Cryptic error messages Nall Intro to R 22 / 44

Challenges Frustrations you will have with R No graphical user interface (GUI) Lots of add-on packages (lightweight base software) Mistype or misspell commands and you re usually short of luck Missing data handling can be confusing Cryptic error messages Nall Intro to R 22 / 44

Challenges Frustrations you will have with R No graphical user interface (GUI) Lots of add-on packages (lightweight base software) Mistype or misspell commands and you re usually short of luck Missing data handling can be confusing Cryptic error messages Nall Intro to R 22 / 44

Challenges Frustrations you will have with R No graphical user interface (GUI) Lots of add-on packages (lightweight base software) Mistype or misspell commands and you re usually short of luck Missing data handling can be confusing Cryptic error messages Nall Intro to R 22 / 44

Challenges Intro to R Professor Clayton Nall h/t Thomas Leeper, Ph.D. June 26, 2014 Nall Intro to R 24 / 44

Challenges Nall Intro to R 25 / 44

Challenges 1 Opportunities 2 Challenges 3 The R Language Nall Intro to R 26 / 44

The R Language 1 Opportunities 2 Challenges 3 The R Language Nall Intro to R 27 / 44

The R Language Try on your own Use R as a calculator: Do the Basic Math tutorial Nall Intro to R 28 / 44

The R Language Tips to Avoid Frustration Always know where you are with getwd() R is case-sensitive: mean is not the same as Mean and cycle through your command history Page Up and Page Down control your screen > prompt means R is ready for a command + means your last command wasn t complete Nall Intro to R 29 / 44

The R Language Tips to Avoid Frustration Always know where you are with getwd() R is case-sensitive: mean is not the same as Mean and cycle through your command history Page Up and Page Down control your screen > prompt means R is ready for a command + means your last command wasn t complete Nall Intro to R 29 / 44

The R Language Tips to Avoid Frustration Always know where you are with getwd() R is case-sensitive: mean is not the same as Mean and cycle through your command history Page Up and Page Down control your screen > prompt means R is ready for a command + means your last command wasn t complete Nall Intro to R 29 / 44

The R Language Tips to Avoid Frustration Always know where you are with getwd() R is case-sensitive: mean is not the same as Mean and cycle through your command history Page Up and Page Down control your screen > prompt means R is ready for a command + means your last command wasn t complete Nall Intro to R 29 / 44

The R Language Tips to Avoid Frustration Always know where you are with getwd() R is case-sensitive: mean is not the same as Mean and cycle through your command history Page Up and Page Down control your screen > prompt means R is ready for a command + means your last command wasn t complete Nall Intro to R 29 / 44

The R Language Questions so far? Nall Intro to R 30 / 44

The R Language Questions so far? Nall Intro to R 31 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 32 / 44

The R Language Try on your own Create variables: Do the Variables tutorial Nall Intro to R 33 / 44

The R Language Questions so far? Nall Intro to R 34 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 35 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 35 / 44

The R Language Try on your own Understand R data structures: Vectors Vector indexing Matrices Lists Dataframes Nall Intro to R 36 / 44

The R Language Questions so far? Nall Intro to R 37 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 38 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 38 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 38 / 44

R Language Basics The R Language Everything in R is an object All objects have a class We execute functions on objects Functions work differently (or not at all) on different classes Functions return objects and print to the console We can then do further things with those objects Nall Intro to R 38 / 44

The R Language Try on your own Understand objects and printing: Do the Objects tutorial Nall Intro to R 39 / 44

The R Language When things go wrong... Nall Intro to R 40 / 44

The R Language When things go wrong... 1 Don t panic 2 Use?functionname to see the help file for a function 3 Parsing errors versus syntax errors: Error: unexpected ) in "lm(y ~)" Error in eval(expr, envir, enclos) : found object y not 4 Google the error or warning 5 Use StackOverflow Nall Intro to R 40 / 44

The R Language A script editor makes your life easier... Helps you understand code more easily Work interactively to build a script R script is like a Stata do file File extension:.r or.r Write down all of your code Use comments (#) liberally Nall Intro to R 41 / 44

... so let s install one The R Language install.packages("devtools") library("devtools") install_github("rite", "leeper") library("rite") rite() Nall Intro to R 42 / 44

... so let s install one The R Language install.packages("devtools") library("devtools") install_github("rite", "leeper") library("rite") rite() Nall Intro to R 42 / 44

... so let s install one The R Language install.packages("devtools") library("devtools") install_github("rite", "leeper") library("rite") rite() Nall Intro to R 42 / 44

... so let s install one The R Language install.packages("devtools") library("devtools") install_github("rite", "leeper") library("rite") rite() Nall Intro to R 42 / 44

... so let s install one The R Language install.packages("devtools") library("devtools") install_github("rite", "leeper") library("rite") rite() Nall Intro to R 42 / 44

... so let s install one The R Language install.packages("devtools") library("devtools") install_github("rite", "leeper") library("rite") rite() Nall Intro to R 42 / 44

The R Language Questions so far? Nall Intro to R 43 / 44