這是Cousera Data science 的Developing Data Products Quiz 3:
【具體課程網頁:Developing Data Products by Johns Hopkins University】
這周主要學習R包,而考察的内容也是R包内的:
Q1:
Which of the following items is required for an R package to pass R CMD check without any warnings or errors?
可直接通過R 命令提示符的可以是:
- vignette
- example data sets
- unit tests
- An explicit software license ✔(當然是R包外的文件許可證)
- a demo directory
除了R包外的文件許可證外,其他的都是R CMD 會運行的。
Q2:
Which of the following is a generic function(泛型函数) in a fresh installation of R, with only the default packages loaded? (Select all that apply)
具體參考與 R:可重用和面向对象编程
- predict ✔
- dgamma
- mean ✔
- lm
- show✔
- colSums
Q3
What function is used to obtain the function body for an S4 method function?
- getS3method()
- getClass()
- getMethod() ✔
- showMethods()
Q4
Please download the R package DDPQuiz3 from the course web site. Examine the \verb|createmean|createmean function implemented in the R/ sub-directory. What is the appropriate text to place above the \verb|createmean|createmean function for Roxygen2 to create a complete help file?
#' This function calculates the mean
#'
#' @return the mean of x
#' @export
#' @examples
#' x <- 1:10
#' createmean(x)
✔