# exclude whole file of R/test.R
package_coverage(exclusions = "R/test.R")
# exclude lines 1 to 10 and 15 from R/test.R
package_coverage(line_exclusions = list("R/test.R" = c(1:10, 15)))
# exclude lines 1 to 10 from R/test.R, all of R/test2.R
package_coverage(line_exclusions = list("R/test.R" = 1:10, "R/test2.R"))
# exclude all print and format methods from the package.
package_coverage(function_exclusions = c("print\\.", "format\\."))
# single line exclusions
f1 <- function(x) {
x + 1 # nocov
}
# ranged exclusions
f2 <- function(x) { # nocov start
x + 2
} # nocov end
Run the code above in your browser using DataLab