R Interactive Environment Setup
Install Quarto Live extension
quarto add r-wasm/quarto-live
YAML Configuration for interactive R
---
format: live-html
webr:
packages:
- dplyr
- ggplot2
---
In-depth Tutorial: Installing Quarto Live & WebAssembly
Basic Interactive R Scripting
Example R code block:
```{webr}
# Basic interactive R script
x <- 1:10
mean(x)
```
Output:
In-depth Tutorial: Interactive R for Beginners
Interactive Plotting
ggplot2 Example
Source
```{webr}
library(ggplot2)
ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point()
```
Output
Plotly Example
Source
```{webr}
library(plotly)
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, type = 'scatter', mode = 'markers')
```
Output
In-depth Tutorial: Interactive Data Visualization in R
Interactive Widgets & Exercises
Creating Interactive Widgets (htmlwidgets)
Source
```{webr}
library(DT)
DT::datatable(iris)
```
Output
Interactive Exercise with Hints and Solutions
Source
::: {.panel-tabset}
#### Exercise
```{webr}
#| exercise: ex_mean
# Calculate the mean of the following vector
vec <- c(2, 4, 6, 8, 10)
mean(vec)
```
#### Hint
`mean()` function.
Use the
#### Solution
```r
mean(vec)
```
:::
Use the mean()
function.
mean(vec)
In-depth Tutorial: Designing and Grading Interactive R Exercises
Further Reading
- Interactive Code Blocks Explained
- Managing Execution Environments
- Interactive Widgets in R
- Shinylive Essentials for R
Explore More Articles
Here are more articles from the same category to help you dive deeper into the topic.
Reuse
Citation
@online{kassambara2025,
author = {Kassambara, Alboukadel},
title = {Interactive {R} {Quick} {Reference} {Cheatsheet}},
date = {2025-03-22},
url = {https://www.datanovia.com/learn/interactive/cheatsheets/interactive-r-quick-reference.html},
langid = {en}
}