[R] Error in R CMD check 2.8.1

Duncan Murdoch murdoch at stats.uwo.ca
Sat Apr 11 19:15:37 CEST 2009


On 11/04/2009 12:33 PM, Michael Friendly wrote:
> Env:  R 2.8.1, Win Xp, Eclipse/StatET
> 
> In a .Rd file, I have an  example  containing the lines:
> 
> # calculate Y M, using polynomial contrasts
> trends <- as.matrix(VocabGrowth) %*% poly(8:11, degree=3)
> colnames(trends)<- c("Linear", "Quad", "Cubic")
> 
> [At the risk of a long message, I'll append the complete .Rd file at the 
> end of this message, in case this was
> triggered by an error elsewhere.]
> 
> I can run R CMD build and R CMD INSTALL without errors, but R CMD check  
> terminates with the following
> error  -- it seems to treat %*% as a Latex comment.  Can anyone see what 
> is wrong?


Rd files do treat % like LaTeX does:  a comment to the end of line, even 
in an Examples section where you probably didn't mean that.

You need to escape the % signs, i.e. use \%*\% instead of %*%.

Duncan Murdoch

> 
> * checking examples ... ERROR
> Running examples in 'heplots-Ex.R' failed.
> The error most likely occurred in:
> 
>  > ### * VocabGrowth
>  >
>  > flush(stderr()); flush(stdout())
>  >
>  > ### Name: VocabGrowth
>  > ### Title: Vocabulary growth data
>  > ### Aliases: VocabGrowth
>  > ### Keywords: datasets
>  >
>  > ### ** Examples
>  >
>  > data(VocabGrowth)
>  >
>  > # Standard Multivariate & Univariate repeated measures analysis
>  > Vocab.mod <- lm(cbind(grade8,grade9,grade10,grade11) ~ 1, 
> data=VocabGrowth)
>  > idata <-data.frame(grade=ordered(8:11))
>  > Anova(Vocab.mod, idata=idata, idesign=~grade)
> Warning in Anova.mlm(Vocab.mod, idata = idata, idesign = ~grade) :
>   the model contains only an intercept: equivalent Type III test substituted
> 
> Type III Repeated Measures MANOVA Tests: Pillai test statistic
>             Df test stat approx F num Df den Df    Pr(>F)   
> (Intercept)  1     0.653  118.498      1     63 4.115e-16 ***
> grade        1     0.826   96.376      3     61 < 2.2e-16 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>  >
>  > # calculate Y M, using polynomial contrasts
>  > trends <- as.matrix(VocabGrowth)
>  > colnames(trends)<- c("Linear", "Quad", "Cubic")
> Error in dimnames(x) <- dn :
>   length of 'dimnames' [2] not equal to array extent
> Calls: colnames<-
> Execution halted
> 
> ---- VocabGrowth.Rd ---
> \name{VocabGrowth}
> \alias{VocabGrowth}
> \docType{data}
> \title{Vocabulary growth data}
> \description{
> Data from the Laboratory School of the University  of Chicago. 
> They consist of scores from a cohort of pupils in grades 8-11 on
> the vocabulary section of the Cooperative Reading Test.  The
> scores are scaled to a common, but arbitrary origin and unit
> of measurement, so as to be comparable over the four grades.
> 
> }
> \usage{data(VocabGrowth)}
> \format{
>   A data frame with 64 observations on the following 4 variables.
>   \describe{
>     \item{\code{grade8}}{Grade 8 vocabulary score}
>     \item{\code{grade9}}{Grade 9 vocabulary score}
>     \item{\code{grade10}}{Grade 10 vocabulary score}
>     \item{\code{grade11}}{Grade 11 vocabulary score}
>   }
> }
> \details{
> Since these data cover an age range in which physical growth
> is beginning to decelerate, it is of interest whether a
> similar effect occurs in the acquisition of new vocabulary.
> }
> \source{
>   R.D.  Bock,
>   \emph{Multivariate statistical methods in behavioral research}, 
> McGraw-Hill, New York,
> 1975, pp453. 
> }
> \references{
>   Keesling, J.W., Bock, R.D. et al, "The Laboratory School study of 
> vocabulary growth",
>   University of Chicago, 1975.
> }
> \examples{
> data(VocabGrowth)
> 
> # Standard Multivariate & Univariate repeated measures analysis
> Vocab.mod <- lm(cbind(grade8,grade9,grade10,grade11) ~ 1, data=VocabGrowth)
> idata <-data.frame(grade=ordered(8:11))
> Anova(Vocab.mod, idata=idata, idesign=~grade)
> 
> # calculate Y M, using polynomial contrasts
> trends <- as.matrix(VocabGrowth) %*% poly(8:11, degree=3)
> colnames(trends)<- c("Linear", "Quad", "Cubic")
> 
> within.mod <- lm(trends ~ 1)
> 
> Manova(within.mod)
> heplot(within.mod, terms="(Intercept)", col=c("red", "blue"), type="3",
>     main="HE plot for Grade effect")
> points(0,0, cex=2.5, col="green", pch=19)
> text(0,0, col="green", pos=2, labels="H0")
> 
> }
> \keyword{datasets}
> --- end ---
>




More information about the R-help mailing list