You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're in the process of preparing a ggplot2 release. As part of the release process, we run the R CMD check on packages that use ggplot2 to make sure we don't accidentally break code for downstream packages.
In running the R CMD check on PepsNMR, we identified the following issue:
checking examples ... ERROR
Running examples in ‘PepsNMR-Ex.R’ failed
The error most likely occurred in:
> ### Name: DrawPCA
> ### Title: Draw the PCA scores or loadings of the signals
> ### Aliases: DrawPCA
> ### Keywords: hplot
>
> ### ** Examples
>
> require(PepsNMRData)
Loading required package: PepsNMRData
> # Draw loadings
> DrawPCA(FinalSpectra_HS, main = "PCA loadings plot",
+ Class = NULL, axes =c(1,3, 5), type ="loadings", loadingstype="l",
+ num.stacked=4, xlab="ppm", createWindow = TRUE)
dev.new(): using pdf(file="Rplots2.pdf")
Error: Aesthetics must be either length 1 or the same as the data (9): label
Execution halted
This error is occuring because PepsNMR was relying on undefined behaviour of annotate(), which isn't designed to draw different items on each facet. To fix this error, we suggest using a geom_*() function with its own data. Note that using .data$col_name within aes() is the preferred way to avoid CMD check issues about undefined variables when mapping columns (make sure you include #' importFrom rlang .data in at least one roxygen documentation block to avoid an error about the name .data being undefined).
library(ggplot2)
plot_data<-data.frame(
facet= c("facet 1", "facet 2"),
x= c(1, 2),
y= c(1, 2)
)
facet_labels<-data.frame(
facet= c("facet 1", "facet 2"),
label= c("Text on facet 1", "Text on facet 2")
)
# to silence CMD check# in the future you will be able to use ggplot2::vars(.data$facet)# but this is currently not supported (tidyverse/ggplot2#2963)facet<-NULL; rm(facet)
ggplot2::ggplot(plot_data, aes(x=.data$x, y=.data$y)) +ggplot2::geom_point() +ggplot2::geom_text(
ggplot2::aes(label=.data$label, x=.data$x, y=.data$y),
data=facet_labels,
x=1.5,
y=1.5
) +ggplot2::facet_wrap(ggplot2::vars(facet))
We hope to release the new version of ggplot2 in the next two weeks, at which point you will get a note from CRAN that your package checks are failing. Let me know if I can help!
The text was updated successfully, but these errors were encountered:
We're in the process of preparing a ggplot2 release. As part of the release process, we run the R CMD check on packages that use ggplot2 to make sure we don't accidentally break code for downstream packages.
In running the R CMD check on PepsNMR, we identified the following issue:
This error is occuring because PepsNMR was relying on undefined behaviour of
annotate()
, which isn't designed to draw different items on each facet. To fix this error, we suggest using ageom_*()
function with its own data. Note that using.data$col_name
withinaes()
is the preferred way to avoid CMD check issues about undefined variables when mapping columns (make sure you include#' importFrom rlang .data
in at least one roxygen documentation block to avoid an error about the name.data
being undefined).We hope to release the new version of ggplot2 in the next two weeks, at which point you will get a note from CRAN that your package checks are failing. Let me know if I can help!
The text was updated successfully, but these errors were encountered: