Basic Vectors


Cut and paste the following vector into your script and then use code to print the requested values related to the vector.

numbers <- c(5, 2, 26, 8, 16)
  1. The number of items in the numbers vector (using the length function)
  2. The third item in the numbers vector (using [])
  3. The smallest number in the numbers vector (using the min function)
  4. The largest number in the numbers vector (using the max function)
  5. The average of the numbers in the numbers vector (using the mean function)
  6. The first, second and third numbers in the numbers vector (using [])
  7. The sum of the values in the numbers vector (using the sum function)