ExpectWarning | R Documentation |
Checks to see if the printing of an object causes warnings to appear.
ExpectWarning(code, string)
code |
The code to evaluate for warnings. |
string |
The string of text to be searched for in the warnings. |
Returns NULL. Throws an exception if the code is evaluated and no warning is thrown or the string does not appear in the warning.
throwsAWarning <- function()
{
warning("This is a warning")
}
ExpectWarning(throwsAWarning(), "a warning")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.