Study. Work. Repeat.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(plotly)

Attaching package: 'plotly'

The following object is masked from 'package:ggplot2':

    last_plot

The following object is masked from 'package:stats':

    filter

The following object is masked from 'package:graphics':

    layout
demo <- tibble(
  year = 2018:2025,
  rent_index = c(100, 103, 106, 109, 118, 130, 142, 150),
  student_pressure = c(45, 47, 49, 52, 60, 68, 73, 78)
)

plot_ly(
  demo,
  x = ~year,
  y = ~student_pressure,
  type = "scatter",
  mode = "lines+markers",
  hoverinfo = "text",
  text = ~paste(
    "<b>Year:</b>", year,
    "<br><b>Pressure index:</b>", student_pressure,
    "<br><b>Rent index:</b>", rent_index
  )
) %>%
  layout(
    title = "A simple demo: pressure rising over time",
    xaxis = list(title = "Year"),
    yaxis = list(title = "Student pressure index")
  )

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).