SlideShare a Scribd company logo
1 of 30
www.r-squared.in/git-hub
R2
Academy
RMarkdown Tutorial For
Beginners
R2
AcademyCourse Material
Slide 2
All the material related to this course are available on our website
Scripts can be downloaded from GitHub
Videos can be viewed on our Youtube Channel
R2
AcademyTable Of Contents
Slide 3
✓ Objectives
✓ Markdown
✓ R Markdown
✓ Syntax
➢ Headers
➢ Emphasis
➢ Lists
➢ Links
➢ Images
➢ Code Chunks
✓ RStudio Settings
✓ References
R2
AcademyLearning Objectives
Slide 4
→ What is Markdown?
→ What is R Markdown?
→ Markdown Syntax
→ RStudio Settings
R2
Academy
Slide 5
What is Markdown?
R2
AcademyWhat is Markdown?
Slide 6
Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write
using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid
XHTML (or HTML).
- John Gruber, creator of Markdown
Markdown is a simple formatting syntax that makes authoring web content easy. It is a
software tool that converts plain text formatting to HTML and is written in Perl.
R2
Academy
Slide 7
What is R Markdown?
R2
AcademyWhat is R Markdown?
Slide 8
R Markdown combines the core syntax of markdown with embedded R code chunks to create
dynamic documents. It enables easy creation of dynamic documents, reports and
presentations which are fully reproducible.
With R Markdown we can combine R codes, plots and text to create beautiful reports and
presentations. The reports can be generated in different formats such as:
● PDF
● MS Word
● HTML
The best part about R Markdown is when you have to make some changes to your codes or
the underlying data and recreate the entire document. You can make the necessary changes
and R Markdown will recreate the document with just a single click.
R2
Academy
Slide 9
Markdown Syntax
R2
AcademyMarkdown Syntax
Slide 10
→ Headers
→ Emphasis
→ Lists
→ Links
→ Images
→ Code Chunks
R2
AcademyHeaders
Slide 11
Markdown HTML Output
# Markdown <h1>Markdown</h1>
Markdown
## Markdown <h2>Markdown</h2>
Markdown
### Markdown <h3>Markdown</h3> Markdown
#### Markdown <h4>Markdown</h4> Markdown
##### Markdown <h5>Markdown</h5> Markdown
###### Markdown <h6>Markdown</h6> Markdown
Headers in Markdown are denoted by the hash character. You can create six levels of headers by
using the hash characters.
R2
AcademyEmphasis
Slide 12
Asterisks ‘*’ or underscores ‘_’ are used to indicate emphasis. Similarly, double
asterisks ‘**’ or double underscores ‘__’ are used to indicate bold.
Markdown HTML Output
*Markdown* <em>Markdown</em> Markdown
_Markdown_ <em>Markdown</em> Markdown
**Markdown** <b>Markdown</b> Markdown
__Markdown_ <b>Markdown</b> Markdown
R2
Academy
Slide 13
Lists
R2
AcademyUnordered Lists
Slide 14
Unordered lists can be created using asterisks ‘*’ or hyphens ‘-’ or pluses ‘+’.
Markdown HTML Output
★ One
★ Two
★ Three
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
● One
● Two
● Three
- One
- Two
- Three
+ One
+ Two
+ Three
R2
AcademyOrdered Lists
Slide 15
Unordered lists can be created using numbers.
Markdown HTML Output
1. One
2. Two
3. Three
<ol>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ol>
1. One
2. Two
3. Three
R2
Academy
Slide 16
Links
R2
AcademyExternal Links
Slide 17
Links to external objects can be created using the following syntax:
Markdown HTML Output
[RStudio](http://www.rstudio.
com/)
<a href=”http://www.rstudio.com/”
>RStudio</a>
RStudio
[Link Title](Link URL)
R2
AcademyInternal Links
Links to sections within a document can be created using the following syntax:
The section identifier must be placed alongside the link and the section title. Keep in mind that there should not be any
space in the section identifier and they must be unique.
[Link Title1](#SectionIdentifier1)
[Link Title2](#SectionIdentifier2)
[Section Title1](#SectionIdentifier1)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi
ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec
auctor lectus pretium finibus. Praesent finibus elit odio. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
[Section Title2](#SectionIdentifier2)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi
ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec
auctor lectus pretium finibus. Praesent finibus elit odio.
Table of Contents
Introduction(#intro)
Data Visualization(#dataviz)
Introduction(#intro)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi
ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec auctor
lectus pretium finibus. Praesent finibus elit odio. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Data Visualization(#dataviz)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi
ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec auctor
lectus pretium finibus. Praesent finibus elit odio. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Slide 18
R2
Academy
Images
Slide 19
R2
AcademyImages
Images can be inserted using the below syntax:
Markdown HTML
![RStudio](rstudio.jpg) <img src="rstudio.jpg" alt="RStudio">
![alt text](path/image)
Slide 20
R2
Academy
Code Chunks
Slide 21
R2
AcademyIntroduction
Slide 22
It is when creating reports that contain
R codes and outputs that we will
appreciate markdown the most. It saves
us from cut/copy/paste ritual while
saving time and minimising errors.
Whenever the code or data changes,
markdown will automatically regenerate
the whole document with the updated
outputs and therein lies its magic.
R2
AcademyInserting Code Chunks
Slide 23
Inserting code chunks in RStudio is very simple. Open a new R Markdown file and on the right hand side you will
find a drop down named Chunks. Click on it and select the option Insert Chunk or alternatively press Ctrl +
Alt + I.
We will understand the syntax of code chunks using the below example:
There are three parts that we need to understand:
R2
AcademySyntax
Slide 24
```{r}
# summary of mtcars data set
summary(cars)
```
Part Description
``` All R codes must be enclosed by the 3 backticks.
{} The term r and output options go here.
Code All the codes/comments go between {} and the second backtick.
There are lots of options available in R Markdown for using codes and their outputs in a document.
We will explore the most important ones:
R2
AcademyOptions
Slide 25
Option Description Example
echo If FALSE, will display only output and not the code
itself.
```{r, echo = FALSE}
summary(mtcars)
```
results If ‘hide’, will display only the code and not the result ```{r, results= hide}
summary(mtcars)
```
fig.height
fig.width
Set the dimensions of a plot. ```{r, fig.width = 4, fig.height = 4}
plot(mtcars$mpg)
```
fig.align Modify the position of the plot. ```{r, fig.align = ‘center’}
plot(mtcars$mpg)
```
R2
Academy
Slide 26
RStudio Settings
R2
AcademyGlobal Options
Slide 27
Go To: Tools > Global Options > Sweave
● Ensure that pdfLaTeX or XeLaTeX is
selected against Typeset Latex into
PDF using: as this will be crucial
while generating PDF documents and
presentations.
● Sumatra is selected in the PDF
Preview section (it will be used for
previewing all the PDF documents
generated).
R2
AcademyPackages
Slide 28
# install the following packages
> install.packages(“rmarkdown”, “knitr”)
# load the libraries
> library(rmarkdown)
> library(knitr)
Install and load the rmarkdown and knitr packages. The current version of R Markdown is
based on knitr and pandoc.
R2
AcademyReferences
Slide 29
Click the below links to learn more about:
➢ Markdown
➢ R Markdown
➢ R Markdown Cheat Sheet
➢ R Markdown Reference Guide
R2
Academy
Slide 30
Visit Rsquared Academy
for tutorials on:
→ R Programming
→ Business Analytics
→ Data Visualization
→ Web Applications
→ Package Development
→ Git & GitHub

More Related Content

What's hot

What's hot (20)

C multiple choice questions and answers pdf
C multiple choice questions and answers pdfC multiple choice questions and answers pdf
C multiple choice questions and answers pdf
 
Excel-VBA
Excel-VBAExcel-VBA
Excel-VBA
 
DS Q&A
DS Q&ADS Q&A
DS Q&A
 
4 R Tutorial DPLYR Apply Function
4 R Tutorial DPLYR Apply Function4 R Tutorial DPLYR Apply Function
4 R Tutorial DPLYR Apply Function
 
4 Descriptive Statistics with R
4 Descriptive Statistics with R4 Descriptive Statistics with R
4 Descriptive Statistics with R
 
1 R Tutorial Introduction
1 R Tutorial Introduction1 R Tutorial Introduction
1 R Tutorial Introduction
 
3. R- list and data frame
3. R- list and data frame3. R- list and data frame
3. R- list and data frame
 
Data manipulation on r
Data manipulation on rData manipulation on r
Data manipulation on r
 
Data Management in R
Data Management in RData Management in R
Data Management in R
 
Step By Step Guide to Learn R
Step By Step Guide to Learn RStep By Step Guide to Learn R
Step By Step Guide to Learn R
 
R programming slides
R  programming slidesR  programming slides
R programming slides
 
Data Visualization With R
Data Visualization With RData Visualization With R
Data Visualization With R
 
R Programming: Mathematical Functions In R
R Programming: Mathematical Functions In RR Programming: Mathematical Functions In R
R Programming: Mathematical Functions In R
 
Chap02 describing data; numerical
Chap02 describing data; numericalChap02 describing data; numerical
Chap02 describing data; numerical
 
Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
 
Getting Started with R
Getting Started with RGetting Started with R
Getting Started with R
 
Data Exploration and Visualization with R
Data Exploration and Visualization with RData Exploration and Visualization with R
Data Exploration and Visualization with R
 
Introduction to statistical software R
Introduction to statistical software RIntroduction to statistical software R
Introduction to statistical software R
 
An Introduction to Data Mining with R
An Introduction to Data Mining with RAn Introduction to Data Mining with R
An Introduction to Data Mining with R
 
Data management in Stata
Data management in StataData management in Stata
Data management in Stata
 

Similar to R Markdown Tutorial For Beginners

C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
Hammad Rajjoub
 
Decorating code (Research Paper)
Decorating code (Research Paper)Decorating code (Research Paper)
Decorating code (Research Paper)
Jenna Pederson
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
Vitaly Baum
 

Similar to R Markdown Tutorial For Beginners (20)

MLflow with R
MLflow with RMLflow with R
MLflow with R
 
R package development, create package documentation isabella gollini
R package development, create package documentation   isabella golliniR package development, create package documentation   isabella gollini
R package development, create package documentation isabella gollini
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
 
C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2C:\Fakepath\Combating Software Entropy 2
C:\Fakepath\Combating Software Entropy 2
 
DTP Certification
DTP CertificationDTP Certification
DTP Certification
 
Consequences of using the Copy-Paste method in C++ programming and how to dea...
Consequences of using the Copy-Paste method in C++ programming and how to dea...Consequences of using the Copy-Paste method in C++ programming and how to dea...
Consequences of using the Copy-Paste method in C++ programming and how to dea...
 
Higher isdd revision presentation
Higher isdd revision presentationHigher isdd revision presentation
Higher isdd revision presentation
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Rmarkdown cheatsheet-2.0
Rmarkdown cheatsheet-2.0Rmarkdown cheatsheet-2.0
Rmarkdown cheatsheet-2.0
 
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
"Technical Challenges behind Visual IDE for React Components" Tetiana Mandziuk
 
React Native Workshop - React Alicante
React Native Workshop - React AlicanteReact Native Workshop - React Alicante
React Native Workshop - React Alicante
 
Decorating code (Research Paper)
Decorating code (Research Paper)Decorating code (Research Paper)
Decorating code (Research Paper)
 
A intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsA intro to (hosted) Shiny Apps
A intro to (hosted) Shiny Apps
 
The Dynamic Language is not Enough
The Dynamic Language is not EnoughThe Dynamic Language is not Enough
The Dynamic Language is not Enough
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
 
Computer fundamentals
Computer fundamentalsComputer fundamentals
Computer fundamentals
 
How to-code-r
How to-code-rHow to-code-r
How to-code-r
 
[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Euro python 2015 writing quality code
Euro python 2015   writing quality codeEuro python 2015   writing quality code
Euro python 2015 writing quality code
 

More from Rsquared Academy

More from Rsquared Academy (20)

Handling Date & Time in R
Handling Date & Time in RHandling Date & Time in R
Handling Date & Time in R
 
Market Basket Analysis in R
Market Basket Analysis in RMarket Basket Analysis in R
Market Basket Analysis in R
 
Practical Introduction to Web scraping using R
Practical Introduction to Web scraping using RPractical Introduction to Web scraping using R
Practical Introduction to Web scraping using R
 
Joining Data with dplyr
Joining Data with dplyrJoining Data with dplyr
Joining Data with dplyr
 
Explore Data using dplyr
Explore Data using dplyrExplore Data using dplyr
Explore Data using dplyr
 
Data Wrangling with dplyr
Data Wrangling with dplyrData Wrangling with dplyr
Data Wrangling with dplyr
 
Writing Readable Code with Pipes
Writing Readable Code with PipesWriting Readable Code with Pipes
Writing Readable Code with Pipes
 
Introduction to tibbles
Introduction to tibblesIntroduction to tibbles
Introduction to tibbles
 
Read data from Excel spreadsheets into R
Read data from Excel spreadsheets into RRead data from Excel spreadsheets into R
Read data from Excel spreadsheets into R
 
Read/Import data from flat/delimited files into R
Read/Import data from flat/delimited files into RRead/Import data from flat/delimited files into R
Read/Import data from flat/delimited files into R
 
Variables & Data Types in R
Variables & Data Types in RVariables & Data Types in R
Variables & Data Types in R
 
How to install & update R packages?
How to install & update R packages?How to install & update R packages?
How to install & update R packages?
 
How to get help in R?
How to get help in R?How to get help in R?
How to get help in R?
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
RMySQL Tutorial For Beginners
RMySQL Tutorial For BeginnersRMySQL Tutorial For Beginners
RMySQL Tutorial For Beginners
 
R Data Visualization Tutorial: Bar Plots
R Data Visualization Tutorial: Bar PlotsR Data Visualization Tutorial: Bar Plots
R Data Visualization Tutorial: Bar Plots
 
R Programming: Introduction to Matrices
R Programming: Introduction to MatricesR Programming: Introduction to Matrices
R Programming: Introduction to Matrices
 
R Programming: Introduction to Vectors
R Programming: Introduction to VectorsR Programming: Introduction to Vectors
R Programming: Introduction to Vectors
 
R Programming: Variables & Data Types
R Programming: Variables & Data TypesR Programming: Variables & Data Types
R Programming: Variables & Data Types
 
Data Visualization With R: Learn To Combine Multiple Graphs
Data Visualization With R: Learn To Combine Multiple GraphsData Visualization With R: Learn To Combine Multiple Graphs
Data Visualization With R: Learn To Combine Multiple Graphs
 

Recently uploaded

FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
MarinCaroMartnezBerg
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
amitlee9823
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
amitlee9823
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
amitlee9823
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
AroojKhan71
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 

Recently uploaded (20)

Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
ELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptxELKO dropshipping via API with DroFx.pptx
ELKO dropshipping via API with DroFx.pptx
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 

R Markdown Tutorial For Beginners

  • 2. R2 AcademyCourse Material Slide 2 All the material related to this course are available on our website Scripts can be downloaded from GitHub Videos can be viewed on our Youtube Channel
  • 3. R2 AcademyTable Of Contents Slide 3 ✓ Objectives ✓ Markdown ✓ R Markdown ✓ Syntax ➢ Headers ➢ Emphasis ➢ Lists ➢ Links ➢ Images ➢ Code Chunks ✓ RStudio Settings ✓ References
  • 4. R2 AcademyLearning Objectives Slide 4 → What is Markdown? → What is R Markdown? → Markdown Syntax → RStudio Settings
  • 6. R2 AcademyWhat is Markdown? Slide 6 Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). - John Gruber, creator of Markdown Markdown is a simple formatting syntax that makes authoring web content easy. It is a software tool that converts plain text formatting to HTML and is written in Perl.
  • 8. R2 AcademyWhat is R Markdown? Slide 8 R Markdown combines the core syntax of markdown with embedded R code chunks to create dynamic documents. It enables easy creation of dynamic documents, reports and presentations which are fully reproducible. With R Markdown we can combine R codes, plots and text to create beautiful reports and presentations. The reports can be generated in different formats such as: ● PDF ● MS Word ● HTML The best part about R Markdown is when you have to make some changes to your codes or the underlying data and recreate the entire document. You can make the necessary changes and R Markdown will recreate the document with just a single click.
  • 10. R2 AcademyMarkdown Syntax Slide 10 → Headers → Emphasis → Lists → Links → Images → Code Chunks
  • 11. R2 AcademyHeaders Slide 11 Markdown HTML Output # Markdown <h1>Markdown</h1> Markdown ## Markdown <h2>Markdown</h2> Markdown ### Markdown <h3>Markdown</h3> Markdown #### Markdown <h4>Markdown</h4> Markdown ##### Markdown <h5>Markdown</h5> Markdown ###### Markdown <h6>Markdown</h6> Markdown Headers in Markdown are denoted by the hash character. You can create six levels of headers by using the hash characters.
  • 12. R2 AcademyEmphasis Slide 12 Asterisks ‘*’ or underscores ‘_’ are used to indicate emphasis. Similarly, double asterisks ‘**’ or double underscores ‘__’ are used to indicate bold. Markdown HTML Output *Markdown* <em>Markdown</em> Markdown _Markdown_ <em>Markdown</em> Markdown **Markdown** <b>Markdown</b> Markdown __Markdown_ <b>Markdown</b> Markdown
  • 14. R2 AcademyUnordered Lists Slide 14 Unordered lists can be created using asterisks ‘*’ or hyphens ‘-’ or pluses ‘+’. Markdown HTML Output ★ One ★ Two ★ Three <ul> <li>One</li> <li>Two</li> <li>Three</li> </ul> ● One ● Two ● Three - One - Two - Three + One + Two + Three
  • 15. R2 AcademyOrdered Lists Slide 15 Unordered lists can be created using numbers. Markdown HTML Output 1. One 2. Two 3. Three <ol> <li>One</li> <li>Two</li> <li>Three</li> </ol> 1. One 2. Two 3. Three
  • 17. R2 AcademyExternal Links Slide 17 Links to external objects can be created using the following syntax: Markdown HTML Output [RStudio](http://www.rstudio. com/) <a href=”http://www.rstudio.com/” >RStudio</a> RStudio [Link Title](Link URL)
  • 18. R2 AcademyInternal Links Links to sections within a document can be created using the following syntax: The section identifier must be placed alongside the link and the section title. Keep in mind that there should not be any space in the section identifier and they must be unique. [Link Title1](#SectionIdentifier1) [Link Title2](#SectionIdentifier2) [Section Title1](#SectionIdentifier1) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec auctor lectus pretium finibus. Praesent finibus elit odio. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. [Section Title2](#SectionIdentifier2) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec auctor lectus pretium finibus. Praesent finibus elit odio. Table of Contents Introduction(#intro) Data Visualization(#dataviz) Introduction(#intro) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec auctor lectus pretium finibus. Praesent finibus elit odio. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Data Visualization(#dataviz) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec pretium mi ligula, quis luctus metus vulputate sed. Donec tincidunt est mauris, nec auctor lectus pretium finibus. Praesent finibus elit odio. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Slide 18
  • 20. R2 AcademyImages Images can be inserted using the below syntax: Markdown HTML ![RStudio](rstudio.jpg) <img src="rstudio.jpg" alt="RStudio"> ![alt text](path/image) Slide 20
  • 22. R2 AcademyIntroduction Slide 22 It is when creating reports that contain R codes and outputs that we will appreciate markdown the most. It saves us from cut/copy/paste ritual while saving time and minimising errors. Whenever the code or data changes, markdown will automatically regenerate the whole document with the updated outputs and therein lies its magic.
  • 23. R2 AcademyInserting Code Chunks Slide 23 Inserting code chunks in RStudio is very simple. Open a new R Markdown file and on the right hand side you will find a drop down named Chunks. Click on it and select the option Insert Chunk or alternatively press Ctrl + Alt + I.
  • 24. We will understand the syntax of code chunks using the below example: There are three parts that we need to understand: R2 AcademySyntax Slide 24 ```{r} # summary of mtcars data set summary(cars) ``` Part Description ``` All R codes must be enclosed by the 3 backticks. {} The term r and output options go here. Code All the codes/comments go between {} and the second backtick.
  • 25. There are lots of options available in R Markdown for using codes and their outputs in a document. We will explore the most important ones: R2 AcademyOptions Slide 25 Option Description Example echo If FALSE, will display only output and not the code itself. ```{r, echo = FALSE} summary(mtcars) ``` results If ‘hide’, will display only the code and not the result ```{r, results= hide} summary(mtcars) ``` fig.height fig.width Set the dimensions of a plot. ```{r, fig.width = 4, fig.height = 4} plot(mtcars$mpg) ``` fig.align Modify the position of the plot. ```{r, fig.align = ‘center’} plot(mtcars$mpg) ```
  • 27. R2 AcademyGlobal Options Slide 27 Go To: Tools > Global Options > Sweave ● Ensure that pdfLaTeX or XeLaTeX is selected against Typeset Latex into PDF using: as this will be crucial while generating PDF documents and presentations. ● Sumatra is selected in the PDF Preview section (it will be used for previewing all the PDF documents generated).
  • 28. R2 AcademyPackages Slide 28 # install the following packages > install.packages(“rmarkdown”, “knitr”) # load the libraries > library(rmarkdown) > library(knitr) Install and load the rmarkdown and knitr packages. The current version of R Markdown is based on knitr and pandoc.
  • 29. R2 AcademyReferences Slide 29 Click the below links to learn more about: ➢ Markdown ➢ R Markdown ➢ R Markdown Cheat Sheet ➢ R Markdown Reference Guide
  • 30. R2 Academy Slide 30 Visit Rsquared Academy for tutorials on: → R Programming → Business Analytics → Data Visualization → Web Applications → Package Development → Git & GitHub