1. What is R, RStudio and R Markdown?

  • R is a popular open-source statistical programming environment.
  • R is freely available for download and runs on Macintosh and Windows computers.
  • RStudio is another freely available software package that has numerous features to make data analysis easier.
  • RStudio is open-source and free program that greatly facilitates the use of R.
  • RStudio gives users a text editor where we write programs, a grapp viewer which displays graphics we make, R console where we execute our programs, a help section, and many other useful features.
  • R Markdown consists of R and Markdown and works on RStudio.
  • Markdown is a Markup language proposed by John Gruber and Aaron Swartz in 2004.
  • R Markdown enables us to document R code, statistical results, and comments into one file

Advantages to use R Markdown on RStudio

  • You can display your idea, R code, statistical results, and comments at the same time in html.
    → You can trace what you have done in your analysis
    → You can avoid human errors in empirical analysis
  • Output type: HTML, PDF, MSWord, PowerPoint

HTML output is highly recommended

What is R Markdown?
・You need to know the difference between plain text and rich text to understand the difference between Markdown and R Markdown

2 types of text   

1. plain text

・A document made up of text which does not include format information, such as the size and the color of characters.
Rmd file we use here is also a plain text.
・Examples of plain text:
- TextEdit (macOS)
- memo (Windows)
plain text does not include functions of formatting or inserting figures and graphs

2. rich text

・ A document made up of text which includes format information. ・ Examples of rich text:
- Microsoft Word
- Pages
- LibreOffice Writer
rich text includes functions of formatting or inserting figures and graphs.

What is Markup lauguage?

Markup language is a language which aims at making a rich text only using plain text
・ Examples of Markup language: HTML:(HyperText Markup Language)
html contains figures, tables, bold characters, and index in addition to plain text.
html is written only by plain text.
・You need a Web Browser which enables you to visualize the text.
・ Examples of Web Browser:
- Firefox
- Chrome
- Edge
・Web Browsers read text
→ Interpret it
→ Visualize it as an output

What is Markdown?

Markdown reconstructs Markup with simpler grammar.

What is R Markdown?

R Markdown is a Markdown which contains R code and its statistical results altogether.

2. Setting up R Markdown

Procedure What you do Steps
I. Make an R Project :Make a folder (ex: keiryo_2023 1 - 5
II. Make an Rmd file : Make a file (ex: first_trial.Rmd 6 - 10
III. Click Knit : Visualize the Rmd file (ex: first_trial.html 11 - 18

I. Make an R Project

  • Make an R Project equals making an R Project foler

Step_1:

  • Start RStusioFileNew Project