Gábor Csárdi
R CMD check
jimhester/covr
jimhester/lintr
goodpractice
goodpractice
features
Package building advice
Test coverage (covr
)
Code style linting (lintr
)
Code complexity
Anti-patterns, anti-functions
Documentation quality (soon)
Custom rule sets
Use on a CI
xmlparsedata
Example: search for 1:nrow(<expression>)
<expr>
+-- <expr>
+-- NUM_CONST: 1
+-- ':'
+-- <expr>
+-- <expr>
+-- SYMBOL_FUNCTION_CALL nrow
+-- '('
+-- <expr>
+-- ')'
XPath
Example: search for 1:nrow(<expr>)
//expr
[expr[NUM_CONST[text()='1']]]
[OP-COLON]
[expr[expr[SYMBOL_FUNCTION_CALL[text()='nrow']]]]
Just convert the R parse tree to XML with xmlparsedata
.
roxygen2
\name{make_style}
\alias{make_style}
\title{Create an ANSI color style}
\usage{
make_style(..., bg = FALSE, grey = FALSE, colors = num_colors())
}
\usage{
\arguments{
\item{\dots}{\itemize{
\item An R color name, see \code{\link{colors}}.
\item A 6- or 8-digit hexa color string, e.g. \code{#ff0000} means
red. Transparency (alpha channel) values are ignored.
\item A one-column matrix with three rows for the red, green
and blue channels, as returned by
\code{\link[grDevices]{col2rgb}}.
}}
...
}
roxygen2
#' Create an ANSI color style
#'
#' @param ... Anything of the following:\itemize{
#' \item An R color name, see \code{\link{colors}}.
#' \item A 6- or 8-digit hexa color string, e.g. \code{#ff0000} means
#' red. Transparency (alpha channel) values are ignored.
#' \item A one-column matrix with three rows for the red, green
#' and blue channels, as returned by \code{\link[grDevices]{col2rgb}}.
#' }
make_style <- function(..., bg = FALSE, grey = FALSE,
colors = num_colors()) {
...
roxygen2
6.0.0 (soon)#' Create an ANSI color style
#'
#' @param Anything of the following:
#' * An R color name, see [colors].
#' * A 6- or 8-digit hexa color string, e.g. `#ff0000` means
#' red. Transparency (alpha channel) values are ignored.
#' * A one-column matrix with three rows for the red, green
#' and blue channels, as returned by [grDevices::col2rgb].
make_style <- function(..., bg = FALSE, grey = FALSE,
colors = num_colors()) {
...
shinytest
package (WIP)library(shinytest)
test_that("the kmeans app updates the plot", {
app <- shinyapp$new("050-kmeans-example")
expect_equal(app$get_value("xcol"), "Sepal.Length")
expect_equal(app$get_value("ycol"), "Sepal.Width")
expect_equal(app$get_value("clusters"), 3)
expect_update(app, xcol = "Sepal.Width", output = "plot1")
expect_update(app, ycol = "Petal.Width", output = "plot1")
expect_update(app, clusters = 4, output = "plot1")
})
shinytest
packagelibrary(shinytest)
test_that("table is rendered and updated", {
app <- shinyapp$new("myapp")
expect_update(app, dataset = "iris", output = "table")
expect_equal(
nrow(app$get_value("table")),
5
)
})