SlideShare una empresa de Scribd logo
1 de 13
Introduction to R
What is R programming language?
• Open source software enviroment for statistical computing and
graphics.
• Object-oriented language i.e we create objects and manipulate them
as intended.
• Functional programming language (it provides many tools for the
creation and manipulation of functions) written primarily in C and
Fortran.
• It's flexible, extensible and comprehesive for productivity.
Why learn R?
Who uses R?
All fields
•
• ICRAFuseR slack channel
• RLadies groups
• Africa R group
• Nairobi R group
• Twitter
R user communities and groups
• A user interface
• An intergrated
development
enviroment (IDE)
What is Rstudio?
NHSLinf
1. Downloading and installing R and Rstudio
To Install R
1. Open an internet browser and go to www.r-project.org.
2. Click the "download R" link in the middle of the page under "Getting Started.”
3. Select a CRAN location (a mirror site) and click the corresponding link.
4. Click on the "Download R for (Mac) OS X" / "Download R for Windows”/ "Download R for Linux" link
under Download and Install R.
5. Click on the file containing the latest version of R .
6. Save the file, double-click it to open, and follow the installation instructions.
7. Now that R is installed, you need to download and install RStudio.
To Install Rstudio
1. Go to www.rstudio.com and click on the "Download RStudio" button
2. Click on "Download RStudio Desktop.”
3. Click on the version recommended for your system, save the file on your computer, double-click it to
open, and then drag and drop it to your applications folder.
Where do I start?
What are they?
A package bundles together code, data, documentation, and tests, and is easy to share with others.
Who develops them?
Any R developer who wants to contribute to the open source community.
How to install?
1. install.packages(”name of package”)
2. Use the Rstudio interface i.e Packages ->install -> type name of package on popup -> install
How to use them in R
1. Load the package i.e library(name of package)
2. You can now start using the package functions
How to get help
1. Use package cheat sheets available online
2. In R console type ??function
R packages
 Data frames
 Vectors
a <- c(1,2,5.3,6,-2,4) # numeric vector
b <- c("one","two","three") # character vector
c <- c(TRUE,TRUE,TRUE,FALSE,TRUE,FALSE) #logical vector
 Matrices
y<-matrix(1:20, nrow=5,ncol=4) # generates 5 x 4 numeric matrix
 Arrays. Are similar to matrices but can have more than two dimensions.
 Lists
w <- list(name="Fred", mynumbers=a, mymatrix=y, age=5.3)
 Factors
gender <- c(rep("male",20), rep("female", 30))
gender <- factor(gender)
Data types in R
2. R resources and materials
1. Package cheat sheets
2. Rstudio help page ??function
3. R for data science book
4. Landscape portal blogs http://landscapeportal.org/blog/categories/r/
5. Data camp
6. Coursera
7. Other R users
8. Just google it
• Always create new folders for each project if applicable
• Always create “New projects” for projects
File New project New Directory Empty Project specify new
directory name and browse to a location on your computer. Create new project
• Set working directory setwd /Users/FMusili/ OneDrive - CGIAR /Scripts/Climatemodule/Climate”)
• Use relative paths (data/shp/Africa-bnd-outline.shp) instead of absolute paths (“/Users/FMusili/
OneDrive - CGIAR /Scripts/Climatemodule/Climate/data/shp/Africa-bnd-outline.shp”)
• Use short and comprehesive object names. Use a naming convention consistently.
• Use comments when writing scripts for easy re-visit by you or someone else “#”
• Use code management systems like github, gitlab, bitbucket etc. for version control and code
backup
• Pipe your code as much as possible -----to be illustrated later
• Practise! Practise! Practise! Practise! Practise! Practise! Practise! Practise! Practise!
Some good practices when programming in R
# My first program in R Programming
myString <- "Hello, World!"
print ( myString)
[1] "Hello, World!"
Basic R
n <- 15
n
[1] 15
5 -> n
n
[1] 5
x <- 1
X <- 10
x
[1] 1
X
[1] 10
m<-3+sqrt(10)
m
[1] 6.162278
R is case sensitive
(10 + 2) * 5
[1] 60
2019
• Introduction to R on 24th October 2019 by Faith Musili
• Reading data in R on 21st November 2019 by Makui Parmutia
• Data manipulation in R (1) on 5th December 2019 by Aida Bargues-
Tobella
2020
….......
ICRAFuseR seminars for beginners

Más contenido relacionado

La actualidad más candente

Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programmingVictor Ordu
 
How to use R easily as GIS tools!
How to use R easily as GIS tools!How to use R easily as GIS tools!
How to use R easily as GIS tools!Omar F. Althuwaynee
 
Intro to java programming
Intro to java programmingIntro to java programming
Intro to java programmingLeah Stephens
 
Intro to Reproducible Research
Intro to Reproducible ResearchIntro to Reproducible Research
Intro to Reproducible ResearchC. Tobin Magle
 
Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?Felix Z. Hoffmann
 
Reproducible research concepts and tools
Reproducible research concepts and toolsReproducible research concepts and tools
Reproducible research concepts and toolsC. Tobin Magle
 
Overview of Data Science
Overview of Data ScienceOverview of Data Science
Overview of Data ScienceKwan-yuet Ho
 
Dancing in R
Dancing in RDancing in R
Dancing in RSimon Roy
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonSpotle.ai
 
Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...
Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...
Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...Rothamsted Research, UK
 
Data and Donuts: Data organization
Data and Donuts: Data organizationData and Donuts: Data organization
Data and Donuts: Data organizationC. Tobin Magle
 
Data and Donuts: Data cleaning with OpenRefine
Data and Donuts: Data cleaning with OpenRefineData and Donuts: Data cleaning with OpenRefine
Data and Donuts: Data cleaning with OpenRefineC. Tobin Magle
 
1. python for data science
1. python for data science1. python for data science
1. python for data scienceDr Nisha Arora
 
R and Rcmdr Statistical Software
R and Rcmdr Statistical SoftwareR and Rcmdr Statistical Software
R and Rcmdr Statistical Softwarearttan2001
 
A brief introduction to 'R' statistical package
A brief introduction to 'R' statistical packageA brief introduction to 'R' statistical package
A brief introduction to 'R' statistical packageShanmukha S. Potti
 
Data Visualizations with ggplot2
Data Visualizations with ggplot2Data Visualizations with ggplot2
Data Visualizations with ggplot2Ryan Harrington
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with REdureka!
 
Business Analytics with R
Business Analytics with R Business Analytics with R
Business Analytics with R Edureka!
 

La actualidad más candente (20)

Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
 
How to use R easily as GIS tools!
How to use R easily as GIS tools!How to use R easily as GIS tools!
How to use R easily as GIS tools!
 
Intro to java programming
Intro to java programmingIntro to java programming
Intro to java programming
 
Intro to Reproducible Research
Intro to Reproducible ResearchIntro to Reproducible Research
Intro to Reproducible Research
 
Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?Open & reproducible research - What can we do in practice?
Open & reproducible research - What can we do in practice?
 
Reproducible research concepts and tools
Reproducible research concepts and toolsReproducible research concepts and tools
Reproducible research concepts and tools
 
Overview of Data Science
Overview of Data ScienceOverview of Data Science
Overview of Data Science
 
Dancing in R
Dancing in RDancing in R
Dancing in R
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...
Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...
Getting the best of Linked Data and Property Graphs: rdf2neo and the KnetMine...
 
Data and Donuts: Data organization
Data and Donuts: Data organizationData and Donuts: Data organization
Data and Donuts: Data organization
 
Data and Donuts: Data cleaning with OpenRefine
Data and Donuts: Data cleaning with OpenRefineData and Donuts: Data cleaning with OpenRefine
Data and Donuts: Data cleaning with OpenRefine
 
1. python for data science
1. python for data science1. python for data science
1. python for data science
 
R and Rcmdr Statistical Software
R and Rcmdr Statistical SoftwareR and Rcmdr Statistical Software
R and Rcmdr Statistical Software
 
A brief introduction to 'R' statistical package
A brief introduction to 'R' statistical packageA brief introduction to 'R' statistical package
A brief introduction to 'R' statistical package
 
Data Visualizations with ggplot2
Data Visualizations with ggplot2Data Visualizations with ggplot2
Data Visualizations with ggplot2
 
Brian_Thomas_Resume_20160215
Brian_Thomas_Resume_20160215Brian_Thomas_Resume_20160215
Brian_Thomas_Resume_20160215
 
Timbuctoo 2 EASY
Timbuctoo 2 EASYTimbuctoo 2 EASY
Timbuctoo 2 EASY
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
 
Business Analytics with R
Business Analytics with R Business Analytics with R
Business Analytics with R
 

Similar a Introduction to r

Up your data game: How to use R to wrangle, analyze, and visualize data faste...
Up your data game: How to use R to wrangle, analyze, and visualize data faste...Up your data game: How to use R to wrangle, analyze, and visualize data faste...
Up your data game: How to use R to wrangle, analyze, and visualize data faste...Charles Guedenet
 
BUSINESS ANALYTICS WITH R SOFTWARE DIAST
BUSINESS ANALYTICS WITH R SOFTWARE DIASTBUSINESS ANALYTICS WITH R SOFTWARE DIAST
BUSINESS ANALYTICS WITH R SOFTWARE DIASTHaritikaChhatwal1
 
R studio practical file
R studio  practical file R studio  practical file
R studio practical file Ketan Khaira
 
MozillaPH Rust Hack & Learn Session 1
MozillaPH Rust Hack & Learn Session 1MozillaPH Rust Hack & Learn Session 1
MozillaPH Rust Hack & Learn Session 1Robert 'Bob' Reyes
 
Useful Open Source Software
Useful Open Source SoftwareUseful Open Source Software
Useful Open Source Softwarepramoddps
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Clark Everetts
 
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
 
Know thy logos
Know thy logosKnow thy logos
Know thy logosVishal V
 
.NET Recommended Resources
.NET Recommended Resources.NET Recommended Resources
.NET Recommended ResourcesGreg Sohl
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 
Driving Innovation with Component-based Development at Boeing
Driving Innovation with Component-based Development at BoeingDriving Innovation with Component-based Development at Boeing
Driving Innovation with Component-based Development at BoeingPerforce
 
Open event (show&tell april 2016)
Open event (show&tell april 2016)Open event (show&tell april 2016)
Open event (show&tell april 2016)Jorge López-Lago
 
Introduction to R and R Studio
Introduction to R and R StudioIntroduction to R and R Studio
Introduction to R and R StudioRupak Roy
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studioDerek Kane
 

Similar a Introduction to r (20)

Up your data game: How to use R to wrangle, analyze, and visualize data faste...
Up your data game: How to use R to wrangle, analyze, and visualize data faste...Up your data game: How to use R to wrangle, analyze, and visualize data faste...
Up your data game: How to use R to wrangle, analyze, and visualize data faste...
 
R_L1-Aug-2022.pptx
R_L1-Aug-2022.pptxR_L1-Aug-2022.pptx
R_L1-Aug-2022.pptx
 
BUSINESS ANALYTICS WITH R SOFTWARE DIAST
BUSINESS ANALYTICS WITH R SOFTWARE DIASTBUSINESS ANALYTICS WITH R SOFTWARE DIAST
BUSINESS ANALYTICS WITH R SOFTWARE DIAST
 
History Of C Essay
History Of C EssayHistory Of C Essay
History Of C Essay
 
R studio practical file
R studio  practical file R studio  practical file
R studio practical file
 
R development
R developmentR development
R development
 
MozillaPH Rust Hack & Learn Session 1
MozillaPH Rust Hack & Learn Session 1MozillaPH Rust Hack & Learn Session 1
MozillaPH Rust Hack & Learn Session 1
 
R tutorial
R tutorialR tutorial
R tutorial
 
Useful Open Source Software
Useful Open Source SoftwareUseful Open Source Software
Useful Open Source Software
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
 
Digital Library Software
Digital Library SoftwareDigital Library Software
Digital Library Software
 
Introduction to R software, by Leire ibaibarriaga
Introduction to R software, by Leire ibaibarriaga Introduction to R software, by Leire ibaibarriaga
Introduction to R software, by Leire ibaibarriaga
 
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
 
Know thy logos
Know thy logosKnow thy logos
Know thy logos
 
.NET Recommended Resources
.NET Recommended Resources.NET Recommended Resources
.NET Recommended Resources
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Driving Innovation with Component-based Development at Boeing
Driving Innovation with Component-based Development at BoeingDriving Innovation with Component-based Development at Boeing
Driving Innovation with Component-based Development at Boeing
 
Open event (show&tell april 2016)
Open event (show&tell april 2016)Open event (show&tell april 2016)
Open event (show&tell april 2016)
 
Introduction to R and R Studio
Introduction to R and R StudioIntroduction to R and R Studio
Introduction to R and R Studio
 
Data Science - Part II - Working with R & R studio
Data Science - Part II -  Working with R & R studioData Science - Part II -  Working with R & R studio
Data Science - Part II - Working with R & R studio
 

Último

THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxANSARKHAN96
 
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLGwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLkantirani197
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsbassianu17
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .Poonam Aher Patil
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learninglevieagacer
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxSilpa
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.Silpa
 
Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.Silpa
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body Areesha Ahmad
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsSérgio Sacani
 
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIACURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIADr. TATHAGAT KHOBRAGADE
 
Zoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdfZoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdfSumit Kumar yadav
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Silpa
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryAlex Henderson
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learninglevieagacer
 
Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.Silpa
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptxryanrooker
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsSérgio Sacani
 

Último (20)

THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
 
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRLGwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
Gwalior ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Gwalior ESCORT SERVICE❤CALL GIRL
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditions
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Genome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptxGenome sequencing,shotgun sequencing.pptx
Genome sequencing,shotgun sequencing.pptx
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
 
Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
 
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune WaterworldsBiogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
Biogenic Sulfur Gases as Biosignatures on Temperate Sub-Neptune Waterworlds
 
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIACURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
 
Zoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdfZoology 5th semester notes( Sumit_yadav).pdf
Zoology 5th semester notes( Sumit_yadav).pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.
 
300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx300003-World Science Day For Peace And Development.pptx
300003-World Science Day For Peace And Development.pptx
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
 

Introduction to r

  • 2. What is R programming language? • Open source software enviroment for statistical computing and graphics. • Object-oriented language i.e we create objects and manipulate them as intended. • Functional programming language (it provides many tools for the creation and manipulation of functions) written primarily in C and Fortran. • It's flexible, extensible and comprehesive for productivity.
  • 5. • • ICRAFuseR slack channel • RLadies groups • Africa R group • Nairobi R group • Twitter R user communities and groups
  • 6. • A user interface • An intergrated development enviroment (IDE) What is Rstudio? NHSLinf
  • 7. 1. Downloading and installing R and Rstudio To Install R 1. Open an internet browser and go to www.r-project.org. 2. Click the "download R" link in the middle of the page under "Getting Started.” 3. Select a CRAN location (a mirror site) and click the corresponding link. 4. Click on the "Download R for (Mac) OS X" / "Download R for Windows”/ "Download R for Linux" link under Download and Install R. 5. Click on the file containing the latest version of R . 6. Save the file, double-click it to open, and follow the installation instructions. 7. Now that R is installed, you need to download and install RStudio. To Install Rstudio 1. Go to www.rstudio.com and click on the "Download RStudio" button 2. Click on "Download RStudio Desktop.” 3. Click on the version recommended for your system, save the file on your computer, double-click it to open, and then drag and drop it to your applications folder. Where do I start?
  • 8. What are they? A package bundles together code, data, documentation, and tests, and is easy to share with others. Who develops them? Any R developer who wants to contribute to the open source community. How to install? 1. install.packages(”name of package”) 2. Use the Rstudio interface i.e Packages ->install -> type name of package on popup -> install How to use them in R 1. Load the package i.e library(name of package) 2. You can now start using the package functions How to get help 1. Use package cheat sheets available online 2. In R console type ??function R packages
  • 9.  Data frames  Vectors a <- c(1,2,5.3,6,-2,4) # numeric vector b <- c("one","two","three") # character vector c <- c(TRUE,TRUE,TRUE,FALSE,TRUE,FALSE) #logical vector  Matrices y<-matrix(1:20, nrow=5,ncol=4) # generates 5 x 4 numeric matrix  Arrays. Are similar to matrices but can have more than two dimensions.  Lists w <- list(name="Fred", mynumbers=a, mymatrix=y, age=5.3)  Factors gender <- c(rep("male",20), rep("female", 30)) gender <- factor(gender) Data types in R
  • 10. 2. R resources and materials 1. Package cheat sheets 2. Rstudio help page ??function 3. R for data science book 4. Landscape portal blogs http://landscapeportal.org/blog/categories/r/ 5. Data camp 6. Coursera 7. Other R users 8. Just google it
  • 11. • Always create new folders for each project if applicable • Always create “New projects” for projects File New project New Directory Empty Project specify new directory name and browse to a location on your computer. Create new project • Set working directory setwd /Users/FMusili/ OneDrive - CGIAR /Scripts/Climatemodule/Climate”) • Use relative paths (data/shp/Africa-bnd-outline.shp) instead of absolute paths (“/Users/FMusili/ OneDrive - CGIAR /Scripts/Climatemodule/Climate/data/shp/Africa-bnd-outline.shp”) • Use short and comprehesive object names. Use a naming convention consistently. • Use comments when writing scripts for easy re-visit by you or someone else “#” • Use code management systems like github, gitlab, bitbucket etc. for version control and code backup • Pipe your code as much as possible -----to be illustrated later • Practise! Practise! Practise! Practise! Practise! Practise! Practise! Practise! Practise! Some good practices when programming in R
  • 12. # My first program in R Programming myString <- "Hello, World!" print ( myString) [1] "Hello, World!" Basic R n <- 15 n [1] 15 5 -> n n [1] 5 x <- 1 X <- 10 x [1] 1 X [1] 10 m<-3+sqrt(10) m [1] 6.162278 R is case sensitive (10 + 2) * 5 [1] 60
  • 13. 2019 • Introduction to R on 24th October 2019 by Faith Musili • Reading data in R on 21st November 2019 by Makui Parmutia • Data manipulation in R (1) on 5th December 2019 by Aida Bargues- Tobella 2020 …....... ICRAFuseR seminars for beginners