Home
71.
If your code generates more than 10 warnings, which function would you use to view them?

The warnings function shows the previous warnings.

72.
What is the class of the return value from a call to try if an error was thrown?

Upon failure, try returns an object of class try-error.

73.
To test that an error is correctly thrown in an RUnit test, you call the checkExcep tion function. What is the testthat equivalent?

The testthat equivalent of checkException is expect_exception. Say that 10 times fast.

74.
Which two functions do you need to mimic executing code typed at the command line?

quote turns a string into a call, then eval evaluates it.

75.
How do you make the print function do different things for different types of input?

Overload functions using the S3 system. A function print.foo will be called for objects of class foo.

76.
Which of the five files in the top-level directory of an R package are compulsory? The files are DESCRIPTION, INDEX, LICENSE, NAMESPACE, and NEWS.

DESCRIPTION and NAMESPACE are compulsory.

77.
Which of the eight directories in an R package are compulsory? The directories are data, demo, doc, inst, man, R, src, and vignettes.

man and R are compulsory in all packages. src is required if you include C, C++, or Fortran code.

78.
Why might you include a CITATION file in your package?

CITATION files let you explain who made and maintains the package, if that information is too long and complicated to go in the DESCRIPTION file.

79.
Which function must you call to generate help files from roxygen2 markup?

roxygenise or roxygenize

80.
What’s the recommended way to politely remove a function from a package?

First warn the user that it is deprecated by adding a call to .Deprecated. Later, replace the body completely with a call to .Defunct.