Exercise: Use the seq() function

The seq() function creates a sequence of whole numbers. The first three of its parameters are: from, to and by.

  • from defines the start of the sequence
  • to defines the end of the sequence
  • by sets the steps between the single values

Use the seq() function and create a sequence of numbers from 2 to 10 but only include every second value. Thus, the output should be: 2, 4, 6, 8, 10.


Submit code to see output here.

Call existing R code through functions