# NOT RUN {
stop("This is an error!", call. = FALSE)
# }
# NOT RUN {
# Inline \donttest is silently ommitted
# }
# NOT RUN {
message("Hi!")
# }
# NOT RUN {
# Block \donttest indicated with comments
# }
# NOT RUN {
# This is a comment
1 + 3
# }
# NOT RUN {
# And works even when not at the top level
if (TRUE) {
# }
# NOT RUN {
1 + 2
# }
# NOT RUN {
}
answer <- 1
# }
# NOT RUN {
answer # should be 42
# To hide the \dontshow part, for conditional examples
# }
# NOT RUN {
answer <- 43
# }
# NOT RUN {
answer # should be still 42
# But this one runs, and the condition is hidden
# }
# NOT RUN {
answer <- 43
# }
# NOT RUN {
answer
# }
Run the code above in your browser using DataLab