1. Learn
  2. /
  3. Courses
  4. /
  5. R 中级

Connected

Exercise

必需参数还是可选参数?

到现在为止,您应该已经很好地理解了必需参数与可选参数的区别。我们用 mean() 函数再来复习一次:

mean(x, trim = 0, na.rm = FALSE, ...)

x 是必需参数;如果不指定它,R 会抛出错误。trim 和 na.rm 是可选参数:它们有默认值,如果您未显式指定,就会使用默认值。

以下关于 read.table() 函数的说法哪些是正确的?

  1. header、sep 和 quote 都是可选参数。
  2. row.names 和 fileEncoding 没有默认值。
  3. read.table("myfile.txt", "-", TRUE) 会抛出错误。
  4. read.table("myfile.txt", sep = "-", header = TRUE) 会抛出错误。

Instructions

50 XP

Possible answers