Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
What are vectors?
Vector operations
Indexing and filtering
Simple analysis
Summary

Instruction

Perfect! One last thing we'd like to mention is that you can pass a filtered vector directly to a function as its argument without having to store that filtered vector in a separate variable.

For example, if we would like to calculate the average of the ages that are less than 35 in our vector named ages, we can do the following:

mean(ages[ages < 35])

R will first perform the appropriate vector filtering and afterwards apply the mean function.

Exercise

Determine the value of the minimum salary that is greater than 5000 dollars. Use the vector salaries.