SlideShare a Scribd company logo
1 of 20
1
Up your data game: How to use R to wrangle,
analyze, and visualize data faster and better
MERL Tech DC 2018
Charles Guedenet, MEL Technical Advisor, IREX
Jonathan Seiden, Learning Research Specialist, Save the Children
Please: Plug in your laptop and check its wifi
download your dataset and r files here: http://bit.ly/merl-r
2
Objectives
By the end of this session, you should:
1. Have R and Rstudio setup on your computer
2. Have a better understanding of what R programming is
and what it can do for you
3. Learn about useful R tools (functions and packages)
that you can use in your own work
4. Feel intrigued (and excited?) enough about R to pursue
further learning
3
What is R?
A programming language for data manipulation
Command-line driven vs. Not point-and-click
Who uses it?
• Academics, journalists, statisticians, open data enthusiasts
4
Who uses R?
5
Pro #1: a reproducible workflow!
6
Pro #2: top notch data visualization!
https://www.r-graph-gallery.com/
7
Pro #3: Flexible & Comprehensive
Work with data across the data life cycle
Get data Cleaning Analysis Data viz Reporting
8
Pro #4: Large & active community
 Tutorials, blogs, websites
R-bloggers.com – news and tutorials by 750+ bloggers
Stats.stackexchange.com
 So much free code! Copy + paste
Kaggle.com
Github.com
 A package for everything - +13k packages
www.r-pkg.org
9
Pro #5: It’s free!
Compare with: ANNUAL Cost
SPSS $1,200 (statistics only) + $$ for addons
SAS $8,700 first year (basic Analytics Pro)
STATA $595 - $1,500
10
Con #1: Steep learning curve
11
Pros and Cons
 Programming language =
reproducible work & huge
efficiency gains
 Top notch data visualization
capabilities
 Flexible & comprehensive
 Active R community
 Free and open source
 A steep learning curve for
programming newbies
 Colleagues/friends may still
prefer STATA SPSS users
Pros Cons
12
Getting setup
1. Install R on your computer
http://lib.stat.cmu.edu/R/CRAN/
Windows or MacOS - choose one of the precompiled
binary distributions (i.e., ready-to-run applications)
linked at the top of the R Project’s webpage.
2. Install RStudio
https://www.rstudio.com/products/rstudio/download/
13
Introduction to Rstudio
Go to your Start menu and in programs start Rstudio by clicking
on the Rstudio icon
14
Rstudio basics
This is what the Rstudio interface looks like
15
Rstudio basics: the console
16
Introduction to Rstudio: Source tabs
This is a built-in text editor
Open an empty script File  New File  R Script
You can write a script and then execute it in the console using Ctrl Shift Enter
17
Global Environment & History
Environment tab - where you can see the values and functions that you’ve
created or imported
History tab –where you can see a list of key strokes you’ve entered in console
18
Files, plots, packages, help
Files – navigate your computer’s files
Packages – find and install packages
Help – search and find help with functions and packages
19
Files, plots, packages, help
A function is a set of statements (or instructions) organized to
perform a specific task.
e.g. sqrt(), sd(), mean()
Packages are collections of R functions, data, and compiled
code in a well-defined format.
The library is where packages are storied on your computer.
20
Basic tips
1. To run a command/function, click the “Run” button or press Ctrl +
Enter
2. R is case sensitive. Make sure your spelling and capitalization are
correct.
3. The $ symbol is used to select a particular column within a table
(e.g., table$column).
4. The # symbol: Any text that you do not want R to act on (such as
comments, notes, or instructions) needs to be preceded by
the # symbol (a.k.a. hash-tag, comment, pound, or number symbol). R
ignores the remainder of the script line following #.
From <http://ncss-tech.github.io/stats_for_soil_survey/chapters/1_introduction/1_introduction.html>

More Related Content

Similar to R to wrangle, analyze, and visualize data faster and better

R studio practical file
R studio  practical file R studio  practical file
R studio practical file Ketan Khaira
 
SessionOne_KnowingRandRStudio
SessionOne_KnowingRandRStudioSessionOne_KnowingRandRStudio
SessionOne_KnowingRandRStudioHellen Gakuruh
 
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali TirmiziFinancial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali TirmiziDr. Muhammad Ali Tirmizi., Ph.D.
 
Big data Big Analytics
Big data Big AnalyticsBig data Big Analytics
Big data Big AnalyticsAjay Ohri
 
Reproducible Research in R and R Studio
Reproducible Research in R and R StudioReproducible Research in R and R Studio
Reproducible Research in R and R StudioSusan Johnston
 
Twitter analysis by Kaify Rais
Twitter analysis by Kaify RaisTwitter analysis by Kaify Rais
Twitter analysis by Kaify RaisAjay Ohri
 
Study of R Programming
Study of R ProgrammingStudy of R Programming
Study of R ProgrammingIRJET Journal
 
A Gentle Introduction to Tidy Statistics in R.pdf
A Gentle Introduction to Tidy Statistics in R.pdfA Gentle Introduction to Tidy Statistics in R.pdf
A Gentle Introduction to Tidy Statistics in R.pdfVickyAlers
 
GET STARTED WITH R FOR DATA SCIENCE
GET STARTED WITH R FOR DATA SCIENCEGET STARTED WITH R FOR DATA SCIENCE
GET STARTED WITH R FOR DATA SCIENCEUSDSI
 
Best corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbaiBest corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbaiUnmesh Baile
 
A Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using RA Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using RNicole Adams
 
R programming for psychometrics
R programming for psychometricsR programming for psychometrics
R programming for psychometricsDiane Talley
 

Similar to R to wrangle, analyze, and visualize data faster and better (20)

R studio practical file
R studio  practical file R studio  practical file
R studio practical file
 
SessionOne_KnowingRandRStudio
SessionOne_KnowingRandRStudioSessionOne_KnowingRandRStudio
SessionOne_KnowingRandRStudio
 
Poly_introduction_R.pdf
Poly_introduction_R.pdfPoly_introduction_R.pdf
Poly_introduction_R.pdf
 
R programming
R programmingR programming
R programming
 
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali TirmiziFinancial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
Financial Risk Mgt - Lec 4 by Dr. Syed Muhammad Ali Tirmizi
 
Toolboxes for data scientists
Toolboxes for data scientistsToolboxes for data scientists
Toolboxes for data scientists
 
R presentation
R presentationR presentation
R presentation
 
Better graphics in R
Better graphics in RBetter graphics in R
Better graphics in R
 
Big data Big Analytics
Big data Big AnalyticsBig data Big Analytics
Big data Big Analytics
 
Reproducible Research in R and R Studio
Reproducible Research in R and R StudioReproducible Research in R and R Studio
Reproducible Research in R and R Studio
 
Twitter analysis by Kaify Rais
Twitter analysis by Kaify RaisTwitter analysis by Kaify Rais
Twitter analysis by Kaify Rais
 
Study of R Programming
Study of R ProgrammingStudy of R Programming
Study of R Programming
 
A Gentle Introduction to Tidy Statistics in R.pdf
A Gentle Introduction to Tidy Statistics in R.pdfA Gentle Introduction to Tidy Statistics in R.pdf
A Gentle Introduction to Tidy Statistics in R.pdf
 
GET STARTED WITH R FOR DATA SCIENCE
GET STARTED WITH R FOR DATA SCIENCEGET STARTED WITH R FOR DATA SCIENCE
GET STARTED WITH R FOR DATA SCIENCE
 
Getting Started with Python
Getting Started with PythonGetting Started with Python
Getting Started with Python
 
Software
SoftwareSoftware
Software
 
Best corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbaiBest corporate-r-programming-training-in-mumbai
Best corporate-r-programming-training-in-mumbai
 
A Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using RA Handbook Of Statistical Analyses Using R
A Handbook Of Statistical Analyses Using R
 
tools
toolstools
tools
 
R programming for psychometrics
R programming for psychometricsR programming for psychometrics
R programming for psychometrics
 

Recently uploaded

9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryJeremy Anderson
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxUnduhUnggah1
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Colleen Farrelly
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfchwongval
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一fhwihughh
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Identifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanIdentifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanMYRABACSAFRA2
 

Recently uploaded (20)

9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
Defining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data StoryDefining Constituents, Data Vizzes and Telling a Data Story
Defining Constituents, Data Vizzes and Telling a Data Story
 
MK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docxMK KOMUNIKASI DATA (TI)komdat komdat.docx
MK KOMUNIKASI DATA (TI)komdat komdat.docx
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Multiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdfMultiple time frame trading analysis -brianshannon.pdf
Multiple time frame trading analysis -brianshannon.pdf
 
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
办理学位证纽约大学毕业证(NYU毕业证书)原版一比一
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Identifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population MeanIdentifying Appropriate Test Statistics Involving Population Mean
Identifying Appropriate Test Statistics Involving Population Mean
 

R to wrangle, analyze, and visualize data faster and better

  • 1. 1 Up your data game: How to use R to wrangle, analyze, and visualize data faster and better MERL Tech DC 2018 Charles Guedenet, MEL Technical Advisor, IREX Jonathan Seiden, Learning Research Specialist, Save the Children Please: Plug in your laptop and check its wifi download your dataset and r files here: http://bit.ly/merl-r
  • 2. 2 Objectives By the end of this session, you should: 1. Have R and Rstudio setup on your computer 2. Have a better understanding of what R programming is and what it can do for you 3. Learn about useful R tools (functions and packages) that you can use in your own work 4. Feel intrigued (and excited?) enough about R to pursue further learning
  • 3. 3 What is R? A programming language for data manipulation Command-line driven vs. Not point-and-click Who uses it? • Academics, journalists, statisticians, open data enthusiasts
  • 5. 5 Pro #1: a reproducible workflow!
  • 6. 6 Pro #2: top notch data visualization! https://www.r-graph-gallery.com/
  • 7. 7 Pro #3: Flexible & Comprehensive Work with data across the data life cycle Get data Cleaning Analysis Data viz Reporting
  • 8. 8 Pro #4: Large & active community  Tutorials, blogs, websites R-bloggers.com – news and tutorials by 750+ bloggers Stats.stackexchange.com  So much free code! Copy + paste Kaggle.com Github.com  A package for everything - +13k packages www.r-pkg.org
  • 9. 9 Pro #5: It’s free! Compare with: ANNUAL Cost SPSS $1,200 (statistics only) + $$ for addons SAS $8,700 first year (basic Analytics Pro) STATA $595 - $1,500
  • 10. 10 Con #1: Steep learning curve
  • 11. 11 Pros and Cons  Programming language = reproducible work & huge efficiency gains  Top notch data visualization capabilities  Flexible & comprehensive  Active R community  Free and open source  A steep learning curve for programming newbies  Colleagues/friends may still prefer STATA SPSS users Pros Cons
  • 12. 12 Getting setup 1. Install R on your computer http://lib.stat.cmu.edu/R/CRAN/ Windows or MacOS - choose one of the precompiled binary distributions (i.e., ready-to-run applications) linked at the top of the R Project’s webpage. 2. Install RStudio https://www.rstudio.com/products/rstudio/download/
  • 13. 13 Introduction to Rstudio Go to your Start menu and in programs start Rstudio by clicking on the Rstudio icon
  • 14. 14 Rstudio basics This is what the Rstudio interface looks like
  • 16. 16 Introduction to Rstudio: Source tabs This is a built-in text editor Open an empty script File  New File  R Script You can write a script and then execute it in the console using Ctrl Shift Enter
  • 17. 17 Global Environment & History Environment tab - where you can see the values and functions that you’ve created or imported History tab –where you can see a list of key strokes you’ve entered in console
  • 18. 18 Files, plots, packages, help Files – navigate your computer’s files Packages – find and install packages Help – search and find help with functions and packages
  • 19. 19 Files, plots, packages, help A function is a set of statements (or instructions) organized to perform a specific task. e.g. sqrt(), sd(), mean() Packages are collections of R functions, data, and compiled code in a well-defined format. The library is where packages are storied on your computer.
  • 20. 20 Basic tips 1. To run a command/function, click the “Run” button or press Ctrl + Enter 2. R is case sensitive. Make sure your spelling and capitalization are correct. 3. The $ symbol is used to select a particular column within a table (e.g., table$column). 4. The # symbol: Any text that you do not want R to act on (such as comments, notes, or instructions) needs to be preceded by the # symbol (a.k.a. hash-tag, comment, pound, or number symbol). R ignores the remainder of the script line following #. From <http://ncss-tech.github.io/stats_for_soil_survey/chapters/1_introduction/1_introduction.html>

Editor's Notes

  1. Intro: R programming language is one of the most popular languages to do data science, used by tons of companies and universities around the globe in all sorts of fields. *The name “R” comes from the initials of the two men who first developed the language at the University of Auckland, Robert Gentleman and Ross Ihaka
  2. Image from https://www.quora.com/Who-even-uses-R-language . (James McInnes) Intro: R programming language is one of the most popular languages to do data science, used by tons of companies and universities around the globe in all sorts of fields. Who uses it and to do what? Why learn R and how does it compare to other programs like Excel, STATA, SPSS, and others? Ford uses R to improve the design of its vehicles. Basically, Twitter uses R to monitor user experience. The US National Weather Service uses R to predict severe flooding. The Human Rights Data Analysis Group uses R to quantify the impact of war. R is being used by The New York Times to create infographics. Google uses R to calculate the ROI of advertising campaigns
  3. 1. R is an actual programming language, with a command-line interface for executing code versus point-and-click Efficiency gains – Useful if you need to reformat every graph or chart at once OR If your data changes after already making your calculations Reproducible - Just like creating a recipe for a meal, a recipe with code makes it possible for anyone to reproduce your work (including your future self). Every step of your analysis is recorded. (It's also useful for validating with other researchers).
  4. https://www.r-graph-gallery.com/
  5. Obtain and reads virtually any type of data – Excel, web scraping, databases (MySQL), foreign (SPSS, SAS) Cleaning and wrangling Analysis – Quant, Qualitative, network analysis, Machine learning, Text mining Data visualization Reporting – publish static results in Word or pdf or make it interactive with rmarkdown and Shiny packages
  6. https://www.r-bloggers.com/ https://cran.r-project.org/web/packages/available_packages_by_name.html 3. Active community It's easy to create so-called packages, which are extensions to R. R's very active community has created thousands of these packages for many different fields. Github.com and stats.stackexchange.com are full of freely available programming code
  7. PROS 1. R is an actual programming language, with a command-line interface for executing code versus point-and-click Efficiency gains – Useful if you need to reformat every graph or chart at once OR If your data changes after already making your calculations 2. Data visualization 3. Flexible & comprehensive - CONS Steep learning curve Resistance from colleagues/friends
  8. Setup If you are running Windows or MacOS, you should choose one of the precompiled binary distributions (i.e., ready-to-run applications) linked at the top of the R Project’s webpage.   Rstudio R Studio is an “Integrated Development Environment”, or IDE. This means it is a front-end for R that makes it much easier to work with. R Studio is also free, and available for Windows, Mac, and Linux platforms.
  9. Rstudio is a particularly user-friendly interface for working with R. It has drop-down menus and many customization options. **The first time you open Rstuio, you’ll see three windows. By default, a fourth window is hidden. Open it by clicking on the File drop-down menu, then New file, and R Script.
  10. The Console is where you can type code and execute. It’s also where you warnings and error messages appear to help you with debugging your code
  11. The benefits are writing code in a script is that your work is saved and can be changed later if, for example, your data changes, you want to make edits to your charts, or you want to share your work with others.
  12. Almost everything in R is done through functions. A function is a set of statements organized together to perform a specific task. R has a large number of in-built functions and the user can create their own functions. Functions may include arguments to help the function accomplish a task. (for example, do not include NA values) Numeric functions Sqrt() Character functions e.g. strsplit(data, split)
  13. From <http://ncss-tech.github.io/stats_for_soil_survey/chapters/1_introduction/1_introduction.html>