SlideShare ist ein Scribd-Unternehmen logo
1 von 12
INTRODUCTION TO R: PART 2
Presenter: Faith Musili
F.Musili@cgiar.org
ICRAF - Geoscience Lab
29th September 2016
Creating a new project
The major purpose of creating a project is to organize your
work for easy revisit later, a project may include as many
scripts as one wishes .
Procedure:
 File
 New project
 New Directory
 Empty Project
Then a popup appears
Cont.…..
 Give your new directory a name and browse to the
destination of your choice.
 Create project
NB: Incase you wish to open the new project in another
session to avoid interrupting the current session , tick the
box at the bottom.
Creating a new R script
window
In the new created project , follow the steps below to
create a new script window;
 File
 New File
 R Script
 Save the r script in the destination of your choice ,by
clicking the save icon at top left corner of scripting
window.
Set working directory
You can either use double backslashes for windows or a single forward slash for mac.
Examples:
Mac
setwd("/Users/FMusili/Documents/2.2")
Windows
Then, click the run button at top right corner of scripting window. Note that in Mac the
shortcut (control+return) and in windows (control+enter) can be used to run a line of code.
Points to note in R scripting
1. No spaces should be used while writing file paths ,instead replace
the spaces with underscores.
2. R syntax is case sensitive.
3. Comment sign "#" is placed at the start of sentences or lines of
code that we don't wish to run.
#####Setting working directory
setwd("/Users/FMusili/Documents/2.2")
Or
setwd("/Users/FMusili/Documents/2.2")###Setting working directory
Creating objects in R
n <- 150
n
58 -> n
n
x <- 0.3
x
X <- 108
X
n<-3+sqrt(10)
n
Basic R syntax
1. Setting the working directory setwd()
2. Knowing which working directory you are presently in
getwd()
3. Installing new packages install.packages("...”)
4. Loading an already installed library library()
5. Knowing which R version you are using version
6. Read more about a function ??....
R packages
Packages are collections of R functions, data, and compiled
code in a well-defined format.
R comes with a standard set of packages. Others are available
for download and installation. Once installed, they have to be
into the session to be used.
Example of downloadable packages:
 Dplyr and tidyr for data manipulation
 Rgdal and raster for spatial data handling
 Igraph for network analysis etc.
Importing data of different
formats
Code…......
Data handling
Code…......
NEXT..........
Exploring Dplyr package in r

Weitere ähnliche Inhalte

Was ist angesagt?

Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.ppt
anandha ganesh
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
Rohit Kumar
 
To Get To The Command Prompt In Windows Xp Go To
To Get To The Command Prompt In Windows Xp Go ToTo Get To The Command Prompt In Windows Xp Go To
To Get To The Command Prompt In Windows Xp Go To
drcha drche
 

Was ist angesagt? (19)

Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
How can I use GNU cotreutils & other command line tools to get a sorted list ...
How can I use GNU cotreutils & other command line tools to get a sorted list ...How can I use GNU cotreutils & other command line tools to get a sorted list ...
How can I use GNU cotreutils & other command line tools to get a sorted list ...
 
Important Linux Commands
Important Linux CommandsImportant Linux Commands
Important Linux Commands
 
Cscope and ctags
Cscope and ctagsCscope and ctags
Cscope and ctags
 
Linux intro 3 grep + Unix piping
Linux intro 3 grep + Unix pipingLinux intro 3 grep + Unix piping
Linux intro 3 grep + Unix piping
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux intro 1 definitions
Linux intro 1  definitionsLinux intro 1  definitions
Linux intro 1 definitions
 
Anandha ganesh linux1.ppt
Anandha ganesh linux1.pptAnandha ganesh linux1.ppt
Anandha ganesh linux1.ppt
 
11 unix osx_commands
11 unix osx_commands11 unix osx_commands
11 unix osx_commands
 
Basic commands
Basic commandsBasic commands
Basic commands
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
Files in c
Files in cFiles in c
Files in c
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
Using the command line on macOS
Using the command line on macOSUsing the command line on macOS
Using the command line on macOS
 
To Get To The Command Prompt In Windows Xp Go To
To Get To The Command Prompt In Windows Xp Go ToTo Get To The Command Prompt In Windows Xp Go To
To Get To The Command Prompt In Windows Xp Go To
 
2006 Esug Omnibrowser
2006 Esug Omnibrowser2006 Esug Omnibrowser
2006 Esug Omnibrowser
 

Ähnlich wie R brownbag seminar 2.2

Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
karlhennesey
 
The Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxThe Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docx
SUBHI7
 
Making%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20WindowsMaking%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20Windows
tutorialsruby
 
Making%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20WindowsMaking%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20Windows
tutorialsruby
 
Laporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdf
Laporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdfLaporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdf
Laporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdf
IGedeArieYogantaraSu
 
Shell tutorial
Shell tutorialShell tutorial
Shell tutorial
Vu Duy Tu
 

Ähnlich wie R brownbag seminar 2.2 (20)

Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docxPart 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
Part 4 Scripting and Virtualization (due Week 7)Objectives1. .docx
 
Assignment OS LAB 2022
Assignment OS LAB 2022Assignment OS LAB 2022
Assignment OS LAB 2022
 
Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)
Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)Advanced Rational Robot   A Tribute (http://www.geektester.blogspot.com)
Advanced Rational Robot A Tribute (http://www.geektester.blogspot.com)
 
The UNIX philosophy
The UNIX philosophyThe UNIX philosophy
The UNIX philosophy
 
Language-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible researchLanguage-agnostic data analysis workflows and reproducible research
Language-agnostic data analysis workflows and reproducible research
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
 
The Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docxThe Korn Shell is the UNIX shell (command execution program, often c.docx
The Korn Shell is the UNIX shell (command execution program, often c.docx
 
Linux basic
Linux basicLinux basic
Linux basic
 
DevTools Package Development
 DevTools Package Development DevTools Package Development
DevTools Package Development
 
sphinx demo
sphinx demosphinx demo
sphinx demo
 
Making%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20WindowsMaking%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20Windows
 
Making%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20WindowsMaking%20R%20Packages%20Under%20Windows
Making%20R%20Packages%20Under%20Windows
 
Laporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdf
Laporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdfLaporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdf
Laporan Praktikum Keamanan Siber - Tugas 3 - Kelas C - Kelompok 3.pdf
 
BITS: Introduction to Linux - Software installation the graphical and the co...
BITS: Introduction to Linux -  Software installation the graphical and the co...BITS: Introduction to Linux -  Software installation the graphical and the co...
BITS: Introduction to Linux - Software installation the graphical and the co...
 
basic linux command (questions)
basic linux command (questions)basic linux command (questions)
basic linux command (questions)
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
 
Introduction to r
Introduction to rIntroduction to r
Introduction to r
 
Shell tutorial
Shell tutorialShell tutorial
Shell tutorial
 
Part 5 of "Introduction to Linux for Bioinformatics": Working the command lin...
Part 5 of "Introduction to Linux for Bioinformatics": Working the command lin...Part 5 of "Introduction to Linux for Bioinformatics": Working the command lin...
Part 5 of "Introduction to Linux for Bioinformatics": Working the command lin...
 
Pos 433 pos433
Pos 433 pos433Pos 433 pos433
Pos 433 pos433
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

R brownbag seminar 2.2

  • 1. INTRODUCTION TO R: PART 2 Presenter: Faith Musili F.Musili@cgiar.org ICRAF - Geoscience Lab 29th September 2016
  • 2. Creating a new project The major purpose of creating a project is to organize your work for easy revisit later, a project may include as many scripts as one wishes . Procedure:  File  New project  New Directory  Empty Project Then a popup appears
  • 3. Cont.…..  Give your new directory a name and browse to the destination of your choice.  Create project NB: Incase you wish to open the new project in another session to avoid interrupting the current session , tick the box at the bottom.
  • 4. Creating a new R script window In the new created project , follow the steps below to create a new script window;  File  New File  R Script  Save the r script in the destination of your choice ,by clicking the save icon at top left corner of scripting window.
  • 5. Set working directory You can either use double backslashes for windows or a single forward slash for mac. Examples: Mac setwd("/Users/FMusili/Documents/2.2") Windows Then, click the run button at top right corner of scripting window. Note that in Mac the shortcut (control+return) and in windows (control+enter) can be used to run a line of code.
  • 6. Points to note in R scripting 1. No spaces should be used while writing file paths ,instead replace the spaces with underscores. 2. R syntax is case sensitive. 3. Comment sign "#" is placed at the start of sentences or lines of code that we don't wish to run. #####Setting working directory setwd("/Users/FMusili/Documents/2.2") Or setwd("/Users/FMusili/Documents/2.2")###Setting working directory
  • 7. Creating objects in R n <- 150 n 58 -> n n x <- 0.3 x X <- 108 X n<-3+sqrt(10) n
  • 8. Basic R syntax 1. Setting the working directory setwd() 2. Knowing which working directory you are presently in getwd() 3. Installing new packages install.packages("...”) 4. Loading an already installed library library() 5. Knowing which R version you are using version 6. Read more about a function ??....
  • 9. R packages Packages are collections of R functions, data, and compiled code in a well-defined format. R comes with a standard set of packages. Others are available for download and installation. Once installed, they have to be into the session to be used. Example of downloadable packages:  Dplyr and tidyr for data manipulation  Rgdal and raster for spatial data handling  Igraph for network analysis etc.
  • 10. Importing data of different formats Code…......