[Rd] R CMD check example problem (PR#8113)

Warnes, Gregory R gregory.r.warnes at pfizer.com
Wed Aug 31 21:46:19 CEST 2005


[Automatic forwarding from R-bugs failed.  This message has been manually
forwarded.]

Hi all!

I'm trying to add Thomas Lumley's defmacro() function  Lumley T.
"Programmer's Niche: Macros in {R}", R News, 2001, Vol 1,
  No. 3, pp 11--13, \url{http://CRAN.R-project.org/doc/Rnews/} to the gtools
package (provided that Thomas gives his OK). And I've encountered an error
in how R CMD check is extracting the example code I have in the .Rd file.

The example section contains the lines 

  # An equivalent function is somewhat messier, since it must either
explicitly
  # construct the y axis label, duplicating some of the work of the plot
  # function:
  plotit <- function( df, var, col="red", title="" )
  {
      dname <- deparse(substitute(df))
      vname <- deparse(substitute(var))
      plot( df[[vname]] ~ df$Grp, type="b", col=col, title=title,
            ylab=paste( dname, "$", vname, sep='' ) )
  }
  # or we explicitly construct the call and then call eval.  The code for
  # the latter approach is # omiited since this is quite messy and
  # requires a lot of work.
  
which is getting extracted for testing into gtools.Rcheck/gtools-Ex.R as

  # An equivalent function is somewhat messier, since it must either
explicitly
  # construct the y axis label, duplicating some of the work of the plot
  # function:
  plotit <- function( df, var, col="red", title=""
)normal-bracket43bracket-normal
      dname <- deparse(substitute(df))
      vname <- deparse(substitute(var))
      plot( df[[vname]] ~ df$Grp, type="b", col=col, title=title,
            ylab=paste( dname, "$", vname, sep='' ) )
  normal-bracket43bracket-normal
  # or we explicitly construct the call and then call eval.  The code for
  # the latter approach is # omiited since this is quite messy and
  # requires a lot of work.

Note that the opening and closing curly brakkets are converted to the string
"normal-bracket43bracket-normal".   [I assume that this is happeing
somewhere to check for brace-matches, and isn't being properly undone.]  As
a consequence, R CMD check is failing:

  > # An equivalent function is somewhat messier, since it must either
explicitly
  > # construct the y axis label, duplicating some of the work of the plot
  > # function:
  > plotit <- function( df, var, col="red", title=""
)normal-bracket43bracket-normal
  >     dname <- deparse(substitute(df))
  >     vname <- deparse(substitute(var))
  >     plot( df[[vname]] ~ df$Grp, type="b", col=col, title=title,
  +           ylab=paste( dname, "$", vname, sep='' ) )
  Error in df[[vname]] : object is not subsettable
  Execution halted

I've checked, and this occurs under R-2.1.0, R-2.1.1, and today's
R-2.2.0-devel on my

  platform i686-pc-linux-gnu
  arch     i686             
  os       linux-gnu        
  system   i686, linux-gnu  

I'm attaching the probelmatic .Rd file to this email.  

  <<defmacro.Rd>> 

(For the record, I've simply enclosed the problematic section in \dontrun as
a workaround.)

-Greg



Gregory R. Warnes, Ph.D.
Associate Director, Non-Clinical Statistics
Pfizer Global Research and Development



LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.


More information about the R-devel mailing list