1. 学习
  2. /
  3. 课程
  4. /
  5. Defensive R Programming

Connected

练习

Using the stop() function

The stop() function is used to indicate that something is wrong.

说明 1 / 共 2 个

undefined XP
    1
    2
  • The function mean_age() calculates the mean age. Stop the execution if any of the ages are negative. You can test if any in vector is negative using the any() function, e.g. any(ages).