R Markdown Basics
Create reproducible reports by combining text, code, and outputs in a single document.
R Markdown Basics is a free R Academy lesson on CoddyKit — lesson 1 of 3. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the R Academy learning path, one of 3 lessons in the course, and your progress syncs across the web and the CoddyKit app.
1
Introduction to R Markdown
R Markdown is a powerful tool for creating dynamic reports that combine code, text, and visualizations in a single document.

2
Installing R Markdown
Before using R Markdown, install and load the package.
install.packages('rmarkdown')
library(rmarkdown)3
Creating an R Markdown File
To create a new R Markdown document in RStudio:
- Go to
File→New File→R Markdown... - Select a title and output format (HTML, PDF, or Word).
4
Basic Structure of an R Markdown File
An R Markdown document consists of three main sections:
- YAML Header: Contains metadata (title, author, date).
- Markdown Content: Includes formatted text.
- Code Chunks: Runs R code inside the document.
---
title: 'My Report'
author: 'John Doe'
date: '2025-03-10'
output: html_document
---5
Adding Code Chunks
Use triple backticks (```{r}) to add R code chunks inside an R Markdown file.
```{r}
summary(mtcars)
```6
Rendering an R Markdown Document
Click the Knit button in RStudio to convert the document into an HTML, PDF, or Word file.
7
Adding Plots
R Markdown allows embedding plots directly within documents.
```{r}
plot(mtcars$mpg, mtcars$hp, main='MPG vs Horsepower')
```8
9
Exporting Reports
R Markdown allows exporting reports in multiple formats, including HTML, PDF, and Word.
10
Summary
In this lesson, you learned:
- How to create and structure an R Markdown document.
- How to add code chunks and plots.
- How to render and export reports in different formats.

Frequently asked questions
Is the “R Markdown Basics” lesson free?
Yes — the full text of “R Markdown Basics” is free to read here on the web, and the R Academy course includes 3 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the R Academy course, upgrade to CoddyKit PRO.
What will I learn in “R Markdown Basics”?
Create reproducible reports by combining text, code, and outputs in a single document. You practise R Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start R Academy?
No prior experience is required. R Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 3, so you can start here or from the beginning and move at your own pace.
How long does the “R Markdown Basics” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this R Academy lesson?
Yes. Every R Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- R Markdown Basics
- Introduction to Shiny Apps
- Deployment and Best Practices