Hello,
I'm building a package in RStudio and using %+replace% in my code. During runtime this is no problem. However during build and test (testthat) an error is raised: R could not find function "%+replace%".
Unlying are the following messages:
no visible global function definition for ‘%+replace%’
and
Undefined global functions or variables:
%+replace%
I use the %+replace% while creating a new ggplot theme based on theme_bw(). Reprex:
my_theme <-
function(base_size = 11,
base_family = "Helvetica",
base_line_size = base_size / 170,
base_rect_size = base_size / 170)
{
ggplot2::theme_bw(
base_size = base_size,
base_family = base_family,
base_line_size = base_line_size
) %+replace%
ggplot2::theme(
# Set style for chart title.
plot.title = ggplot2::element_text(
size = ggplot2::rel(1.5),
colour = "dodgerblue3",
face = "bold"
),
complete = FALSE
}
which is then used in creating plots:
ggplot(iris, eas(x = Sepal.Length, y = Petal.Length, colour = Species)) +
geom_jitter() + my_theme() + labs(title = "IRIS plot with my theme")
I guess I have to prefix %+replace% with a package name but is that true, and if so what should be the package name? TIA.
BR.