Exercise: Use the sample() function

The sample() function takes a vector and returns a random sample from it. The first two of its parameters are:

  • x, which defines the vector
  • size, which defines the number of elements we want to include in the random sample

Use the sample() function and sample 5 random values from the full variable.

Output

Submit code to see output here.

Call existing R code through functions