Compute test coverage for an R package using covr::package_coverage().
Returns either a file-level summary for the entire package or line-level
details for a specific file.
Arguments
- pkg
Path to package directory. Defaults to
".". Must be within current working directory.- filename
Optional filename to filter coverage results. If
NULL(default), returns file-level summary for entire package. If provided, returns line-level results for the specified file.- _intent
An optional string describing the intent of the tool use. When the tool is used by an LLM, the model will use this argument to explain why it called the tool.
Value
A data frame with different structures depending on filename:
When
filename = NULL: Returns file-level summary with columnsfilenameandcoverage(percentage).When
filenameis specified: Returns line-level details with columnsfilename,functions,line_start,line_end,is_covered, andmed_hits.
See also
Other pkg tools:
btw_tool_pkg_check(),
btw_tool_pkg_document(),
btw_tool_pkg_test()
