4.4 Tip: do check that the inputs are as expected

  • The first check is whether x is a list (and assumes it contains x and y variables)
  • The second check is if y is NULL, in this case the y variable will have the values of x and the x variable will just indicate how many observations there are
  • It is very clever to also check if x and y are NULL, nothing can be done and the function stops