has.error | R Documentation |
Whether a function or series of calls results in error
has.error(...)
... |
the expression or function calls |
boolean value to indicate if the expression produces errors
More information, check: https://rpkg.net/package/quickcode
# this should not produce error
# so the function result should be FALSE
has.error({
x = 8
y = number(10)
res = x + y
})
# this should produce the following error
# Error in x + y : non-numeric argument to binary operator
# so the function result should be TRUE
has.error({
x = 8
y = "random"
res = x + y
})
# this should result in error because
# the dataset does not contain a "rpkg.net" column
# the result should be TRUE
df1 = mtcars
has.error(df1[,"rpkg.net"])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.