YAML:
What does incremental means?
It means each element of a list is shown incrementally instead of showing all text from the beginning
Here’s a new line! Shown incrementally
Warning
All contents in all slides are displayed incrementally!
When:
This prevents incremental lists:
You can force incremental contents
By pausing the contents
These options will be applied to all slides
---
title: "03-Presentations"
author:
name: "Ottavia M. Epifania, Ph.D."
email: ottavia.epifania@unitn.it
affiliation: "ARCA summer school"
format:
revealjs:
self-contained: true
scrollable: true
logo: "www/freepalestine.jpg"
footer: "Presentations"
incremental: true
slide-number: c/t
show-slide-number: all
---
To delete the footer
To make the content scrollable
To make the content smaller
A lot of predefined themes!
Use the pre-defined themes with personalized .scss
file:
/*-- scss:defaults --*/
// fonts
$font-family-sans-serif: "Palatino Linotype", "Book Antiqua", Palatino,
FreeSerif, serif !default;
$presentation-font-size-root: 34px;
// headings
$presentation-heading-font: "Palatino Linotype", "Book Antiqua", Palatino,
FreeSerif, serif !default;
$presentation-h1-font-size: 1.8em;
$presentation-h2-font-size: 1.4em;
$presentation-h3-font-size: 1.2em;
// code
$code-block-font-size: 0.70em;
$callout-style-font-size: .5em;
$callout-style-font-weight: 400;
$slide-logo-size: 200px;
/*-- scss:rules --*/
.reveal a {
line-height: 1.3em;
}
Define a new theme. Here all the elements that can be modified
Save the theme in a file mytheme.scss
and theme: mytheme.scss
/*-- scss:defaults --*/
// fonts
$font-family-sans-serif: "Palatino Linotype", "Book Antiqua", Palatino,
FreeSerif, serif !default;
// colors
$body-bg: #fff !default;
$body-color: #000 !default;
$link-color: #51483d !default;
$selection-bg: #26351c !default;
$presentation-font-size-root: 32px;
// headings
$presentation-heading-font: "Palatino Linotype", "Book Antiqua", Palatino,
FreeSerif, serif !default;
$presentation-heading-color: #9B0014 !default;
$presentation-h1-font-size: 1.8em;
$presentation-h2-font-size: 1.4em;
$presentation-h3-font-size: 1.2em;
$callout-style-font-size: .5em;
$callout-style-font-weight: 400;
$slide-logo-size: 200px;
/*-- scss:rules --*/
.reveal a {
line-height: 1.3em;
}
This text will turn red
Create a slide with absolute positioning of two pictures
Create a slide with stacked content (you can decide what and how)
Let’s say you are presenting something that is really complicated and you need some boost of confidence
When you are in presentation mode, just press S
:
My blood brother is an immigrant, a beautiful immigrant 1
My blood brother is an immigrant, a beautiful immigrant ^[This song is [Danny Nedelko](https://youtu.be/QkF_G-RF66M?si=F11TuQYUtWVz0L9G) by IDLES]
::: aside
Fear leads to panic, panic leads to pain
Pain leads to anger, anger leads to hate
Yeah, yeah, yeah, yeah, ah, ah, ah, ah
Yeah, yeah, yeah, yeah, ah, ah, ah, ah
[Danny Nedelko](https://youtu.be/QkF_G-RF66M?si=F11TuQYUtWVz0L9G)
:::
The syntax and the code seen so far for the code chunk remain the same:
```{r}
#| eval: false
#| echo: true
head(rock)
```
## {auto-animate="true"}
```{r}
#| echo: true
# Create a scatterplot with a smoothing function
ggplot(mtcars,
aes(mpg, hp, size = gear)) +
geom_point()
```
## {auto-animate="true"}
```{r}
#| echo: true
# Create a scatterplot with a smoothing function
ggplot(mtcars,
aes(mpg, hp, size = gear)) +
geom_point() +
geom_smooth()
```
fragment
column-fragment
slide
slide
column
Interactive plots with plotly
library(plotly) # you have to first install it :)
graph = mtcars %>%
ggplot( aes(mpg, hp, color = gear)) +
geom_point() +
geom_smooth()
ggplotly(graph)
graph
plotly
ui
(User Interface)
The container, whatever sees the user
Used for setting the desired configurations of options that will be elaborated in the server
Used for displaying the results of the computations that took place in the server
server
It gets the work done, according to the configuration set in the UI
Replaces the results into the allocated spaces
Define something in the
ui
and not using in the server: nothing happens, it just doesn’t existCalling something in the server that has not been defined in the
ui
: errors everywhere
sliderInput() # Slider input widget
numericInput() # Numeric input control
selectInput() # Select list input control
checkboxInput() # Checkbox input control
checkboxGroupInput()
dateInput() # Date input
fileInput() # File upload control
radioButtons() # Radio buttons
textInput() # Text input control
passwordInput() # Password input control
actionButton() # Action button
dateInput() # Date input
dateRangeInput() # Input a data range
Complete list (with code)
plotOutput() # Plot output element
textOutput() # Text output element
verbatimTextOutput() # Verbatim text output element
tableOutput() # Table output element
dataTableOutput() # Data table output element
htmlOutput() # HTML output element
uiOutput() # user interface element
downloadButton() # Download button
Progress() # Reporting progress (object oriented)
withProgress() # Reporting progress (functional)
outputOptions() # Set options for an output object
ui = fluidPage(
selectInput(inputId = "mySelection",
label = h3("Select box"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1),
verbatimTextOutput(
outputId = "myOutput"
)
)
server = function(input, output) {
output$myOutput = renderText({
paste(paste("This is my choice"), input$mySelection)
})
}
ui = fluidPage(
selectInput(inputId = "mySelection",
label = h3("Select box"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1),
verbatimTextOutput(
outputId = "myOutput"
)
)
server = function(input, output) {
output$myOutput = renderText({
paste(paste("This is my choice"), input$mySelection)
})
}
shinyApp(ui, server)
```{r}
#| eval: false
#| context: server
output$graph <- renderPlot({
if(input$dataset == "rock"){ # call the input and its options with their label
data <- rock
} else if (input$dataset == "pressure" ){
data <- pressure
} else if (input$dataset == "cars") {
data <- cars
}
plot(data[, c(1:2)])
})
output$summary <- renderPrint({
if(input$dataset == "rock"){
data <- rock
} else if (input$dataset == "pressure" ){
data <- pressure
} else if (input$dataset == "cars") {
data <- cars
}
summary(data[, c(1:2)])
})
```