Paul Roebuck
2009-Jan-15 17:50 UTC
[Rd] [Q] R CMD check signals error on code that works from UI
Add the following to example section of a dot-Rd manpage: ## :WHY: The following kills R CMD check but runs fine on console. foos <- c("aaa", "bbb", "ccc") cat(sapply(foos, function(foo) { sprintf("name: %-18s upper: %s\n", foo, toupper(foo)) }), sep="") R CMD check <package> stops with error: ... * checking examples ... ERROR Running examples in '<package>-Ex.R' failed. The error most likely occurred in: ...> > ## :WHY: The following kills R CMD check but runs fine on console. > foos <- c("aaa", "bbb", "ccc") > cat(sapply(foos,+ function(foo) { + sprintf("name: + foo, + toupper(foo)) + }), sep="") + + + + cleanEx(); nameEx("sc80-registerNormalizationMethod") Error: unexpected string constant in: " cleanEx(); nameEx("" Execution halted Yet on console, it provides the expected: name: aaa upper: AAA name: bbb upper: BBB name: ccc upper: CCC How do I work around this for manpage? ---------------------------------------------------------- SIGSIG -- signature too long (core dumped)
Sklyar, Oleg (London)
2009-Jan-15 18:05 UTC
[Rd] [Q] R CMD check signals error on code that works from UI
Because there is a % sign, which is stripped out by LaTeX used to build the help system as a comment. Just look at how your example code is output -- the string is unterminated because the matching quote is masked by % latex comment Dr Oleg Sklyar Research Technologist AHL / Man Investments Ltd +44 (0)20 7144 3107 osklyar at maninvestments.com> -----Original Message----- > From: r-devel-bounces at r-project.org > [mailto:r-devel-bounces at r-project.org] On Behalf Of Paul Roebuck > Sent: 15 January 2009 17:50 > To: R Development Mailing List > Subject: [Rd] [Q] R CMD check signals error on code that works from UI > > Add the following to example section of a dot-Rd manpage: > > ## :WHY: The following kills R CMD check but runs fine on console. > foos <- c("aaa", "bbb", "ccc") > cat(sapply(foos, > function(foo) { > sprintf("name: %-18s upper: %s\n", > foo, > toupper(foo)) > }), sep="") > > > R CMD check <package> stops with error: > > ... > * checking examples ... ERROR > Running examples in '<package>-Ex.R' failed. > The error most likely occurred in: > ... > > > > ## :WHY: The following kills R CMD check but runs fine on console. > > foos <- c("aaa", "bbb", "ccc") > > cat(sapply(foos, > + function(foo) { > + sprintf("name: > + foo, > + toupper(foo)) > + }), sep="") > + > + > + > + cleanEx(); nameEx("sc80-registerNormalizationMethod") > Error: unexpected string constant in: > " > cleanEx(); nameEx("" > Execution halted > > > Yet on console, it provides the expected: > > name: aaa upper: AAA > name: bbb upper: BBB > name: ccc upper: CCC > > > How do I work around this for manpage? > > > ---------------------------------------------------------- > SIGSIG -- signature too long (core dumped) > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >********************************************************************** Please consider the environment before printing this email or its attachments. The contents of this email are for the named addressees ...{{dropped:19}}