Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Creating functions
10. Arguments and their names
If statements


Great! There are two ways you can provide argument values during a function call:

  1. By position. This is how we've called our functions so far. You simply list values in the argument list in order, and R matches them up with the corresponding arguments by position. For example, when you invoke
    low_quality_column(survey$birthyear, 0.8)
    R passes in the value of survey$birthyear to the column argument and 0.8 to the threshold argument.
  2. By name. Optionally, you can explicitly provide each argument's name followed by the assignment operator and the corresponding value you want to assign. For example,
    low_quality_column(column = survey$birthyear, threshold = 0.8)
    will give you the exact same result as
    low_quality_column(survey$birthyear, 0.8)
    or as
    low_quality_column(threshold = 0.8, column = survey$birthyear)

It's always recommended that you pass in arguments using explicit naming. This helps improve the readability of your code.


Use the low_quality_column() function to check the quality of the love_your_job column (survey data frame). Use a threshold of 0.4. Use argument names.