# Scrollama Document with the Sidebar Layout

{css, echo=FALSE} .level1 { min-height: 400px; border: 1px solid; margin-bottom: 4em; padding: 1em 2em 2em; opacity: .5; } .is-active { opacity: 1; background-color: lightyellow; } body { margin-bottom: 80vh; } table { border-collapse: collapse; }



# Get started

You can create a new Scrollama document with the sidebar layout from the RStudio IDE: File -> New File -> R Markdown -> From Template, and use the template "Scrollama Document (Sidebar Layout)".

# The layout

The main body of the document is displayed in the sidebar on the left. Figures, tables, and videos will be displayed in their full sizes in the main area on the right.

For example, here is a simple table:

{r}
knitr::kable(head(mtcars), caption = 'A boring table.')


As you scroll over the document, the first-level section that comes to the view will be highlighted, and the figure or table or video in the view in that section will be displayed on the right (if exists).

# Plots

You may include any number of plots in a section.

par(mar = c(4, 4, .5, .1)) plot(cars, pch = 19) for (z in 4:1) curve(z/x, 0, 10, add = z < 4, col = z)

That's it.