Session Ready
Exercise

What is sample code?

The different parts of an exercise should complement each other. Sample code along with the instructions provide guidance in interactive exercises. Furthermore, sample code must match the solution code to ensure students can learn from their mistakes and move onto the next exercise without frustration.

This exercise has three parts:

  1. A good sample code example
  2. A bad sample code example
  3. A Multiple Choice exercise to test your understanding

These DataCamp hotkeys will help you during this exercise:

Hotkey Function
Ctrl + h (1x) Show hint
Ctrl + h (2x) Show solution

Start by generating the solution and tab back-and-forth between script.R and solution.R in each step.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Use Ctrl + h twice to show the solution code.
  • In this step, you can easily determine the missing code and see different levels of scaffolding throughout the sample code. Generally, more scaffolding increases the level of difficulty.
  • Read through the code comments. Note that a student with knowledge of the dplyr package could use the code comments to complete the exercise.
  • Press the Run Solution button when in the solution.R window.