Nulls in Vectors (Vectors)
Cut and paste the following vector into your assignment.
Then use code to print the requested values related to the vector.
You’ll need to use na.rm = TRUE to ignore the null values when doing calculations (but not when finding the values at different positions or determining the lenght of the vector).
numbers <- c(7, 6, 22, 5, NA, 42)
- The smallest number in the
numbersvector - The average of the numbers in the
numbersvector - The length of the
numbersvector (including the NA) - The sum of the values in the
numbersvector - The second value in
numbers - The largest number in the
numbersvector