[R] Weird errors with R CMD check/ggplot2 in examples: how to debug?
Michael Friendly
friendly at yorku.ca
Wed Nov 4 16:52:51 CET 2009
[Environment: WinXp, R 2.9.2, all packages up to date; building under
(StatET 0.8, eclipse 3.5.1) or from a batch file]
I'm in the process of creating a package, HistData, on R-forge,
containing interesting data sets
from the history of statistics and data visualization. It contains
several examples that use ggplot2,
which I've declared as a Suggests: in the DESCRIPTION file. The
examples work fine when
run in a separate R session. However, they fail under R CMD check, and
I can neither
diagnose or understand the error (shown below).
How can I debug this? i.e., Is there something I can add to the example
to help track down the cause of these errors?
Has anyone experienced anything similar?
\examples{
require(ggplot2)
plot_troops <- ggplot(Minard.troops, aes(long, lat)) +
geom_path(aes(size = survivors, colour = direction, group = group))
plot_both <- plot_troops +
geom_text(aes(label = city), size = 4, data = Minard.cities)
plot_polished <- plot_both +
scale_size(to = c(1, 12),
breaks = c(1, 2, 3) * 10^5, labels = comma(c(1, 2, 3) * 10^5)) +
scale_colour_manual(values = c("grey50","red")) +
xlab(NULL) +
ylab(NULL)
# need to re-scale the plot window to an aspect ratio of ~ 4 x 1
plot_polished
}
When I run R CMD check on the package
[under eclipse 3.5.1/StatET 0.8/Win Xp/R 2.9.2] I get an error (a
complete log file is appended at the end of this post):
...
running examples in 'HistData-Ex.R' failed.
The error most likely occurred in:
> ### * Minard
>
> flush(stderr()); flush(stdout())
>
> ### Name: Minard
> ### Title: Data from Minard's famous graphic map of Napoleon's march on
> ### Moscow
> ### Aliases: Minard Minard.cities Minard.troops Minard.temp
> ### Keywords: datasets
>
> ### ** Examples
>
> data(Minard.troops); data(Minard.cities)
> ## maybe str(Minard.troops) ; plot(Minard.troops) ...
>
> require(ggplot2)
Loading required package: ggplot2
> plot_troops <- ggplot(Minard.troops, aes(long, lat)) +
+ geom_path(aes(size = survivors, colour = direction, group = group))
Error in rename_aes(aes) : could not find function "rename"
Calls: ggplot -> ggplot.data.frame -> inherits -> aes -> rename_aes
Execution halted
Consequently, I've been forced to put that example inside of
\dontrun{}. I thought it might be a problem associated with
StatET/eclipse, but I get exactly the same result when I run R CMD check
from a batch file outside of eclipse.
My DESCRIPTION file includes ggplot2 and all it's dependencies in Suggests:
Suggests: gtools, KernSmooth, maps, ggplot2, proto, grid, reshape, plyr
I shouldn't have to include ggplot2 dependencies in examples, but if I add
require(reshape)
require(plyr)
I still get 'could not find function' errors.
I have all relevant packages up to date:
> sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base other attached packages:
[1] ggplot2_0.8.3 reshape_0.8.3 plyr_0.1.9 proto_0.3-8 HistData_0.3
loaded via a namespace (and not attached):
[1] tools_2.9.2
>
--- 00check.log ---
* using log directory 'C:/R/R-2.9.2/src/library/HistData.Rcheck'
* using R version 2.9.2 (2009-08-24)
* using session charset: ISO8859-1
* checking for file 'HistData/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'HistData' version '0.5'
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking for .dll and .exe files ... OK
* checking whether package 'HistData' can be installed ... OK
* checking package directory ... OK
* checking for portable file names ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking Rd files ... OK
* checking Rd files against version 2 parser ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking data for non-ASCII characters ... WARNING
Warning: found non-ASCII string(s)
'Johann Sch<f6>ner' 'NA'
Portable packages use only ASCII characters in their datasets.
* checking examples ... ERROR
Running examples in 'HistData-Ex.R' failed.
The error most likely occurred in:
> ### * Minard
>
> flush(stderr()); flush(stdout())
>
> ### Name: Minard
> ### Title: Data from Minard's famous graphic map of Napoleon's march on
> ### Moscow
> ### Aliases: Minard Minard.cities Minard.troops Minard.temp
> ### Keywords: datasets
> ### spatial
>
> ### ** Examples
>
> data(Minard.troops); data(Minard.cities)
>
> require(ggplot2)
Loading required package: ggplot2
> plot_troops <- ggplot(Minard.troops, aes(long, lat)) +
+ geom_path(aes(size = survivors, colour = direction, group = group))
Error in rename_aes(aes) : could not find function "rename"
Calls: ggplot -> ggplot.data.frame -> inherits -> aes -> rename_aes
Execution halted
--- end 00check.log ---
-Michael
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
More information about the R-help
mailing list