Introduction to Exercises

Overview

Teaching: 20 min
Exercises: 10 min
Questions
  • How to write a exercise?

Objectives
  • Know how to write a exercise.

This is our first exercise.

print("Hello Carpentries instructors!")
Hello Carpentries instructors!
x <- c(4,)
Missing element after comma
4 -> x

What is need in a exercise

List all the elements that you need inside a exercise to comply with the Carpentries style.

Solution

Exercises are inside a >-block and each block must have

  • one title
  • exercise body
  • solution to exercise

You can use code blocks inside exercises.

How to use R code in R Markdown

Provide one example of one R code that is going to be run by R Markdown.

Solution

x <- 1
1 -> y
x + y

Key Points

  • Exercises are write inside >-block.