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

ligges@statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Thu Sep 1 18:23:05 CEST 2005


[CCing to r-bugs to inform people that we have looked at it.]

Greg,

you sent me the example which can be reduced to an example.Rd file that 
contains the following Example section:


############################
\examples{
# \code{} \code{}
foo <- function()
{
}
}
############################

calling now
    R CMD Rdconv -t example example.Rd
results in:



############################
### ** Examples

# this-is-escaped-code{ this-is-escaped-codenormal-bracket9bracket-normal
foo <- function()
normal-bracket10bracket-normal
normal-bracket10bracket-normal
############################


I do not know whether this qualifies as a bug, but for simplicity let's say:
"Don't use \code{} in an Example section where it does not make sense 
anyway."

Best,
Uwe






Warnes, Gregory R wrote:

> 
>>-----Original Message-----
>>From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de]
>>Sent: Thursday, September 01, 2005 8:57 AM
>>To: Warnes, Gregory R
>>Subject: Re: [Rd] R CMD check example problem (PR#8113)
>>
>>
>>Greg,
>>
>>the attachment is not appended on the forwarded message to 
>>R-devel, and 
>>I would like to take a look, can you send it in a private 
>>message, please?
>>
>>Best,
>>Uwe
>>
>>Warnes, Gregory R wrote:
>>
>>
>>>[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.
>>
>>>
>>>
>>--------------------------------------------------------------
>>----------
>>
>>>______________________________________________
>>>R-devel at r-project.org mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>>
>



More information about the R-devel mailing list