[Roxygen-devel] Problem with backslashes in default arguments for usage

Gavin Kelly gavin.kelly at cancer.org.uk
Wed Aug 5 18:01:22 CEST 2009


Hi,
Firstly, thanks for a great package - just what I needed to get me to
package up all the bits of scripts I have.

I've downloaded the latest version from R-forge (roxygen_0.1-1) as I was
having difficulty with quotes in default arguments not propagating
correctly through to \usage in a .Rd file.  But now I'm having the same
difficulty with backslashes:


##' Generate a new column that is based on a match of another column
##' @param col The column to be matched against
##' @param colRE The regular expression that will detect rows to be
propogated
##' @param replacement A replacement expression that be used to generate
the ne\
w row values
##' @return The column containing propogated values
colAdder <- function(col, colRE, replacement="\\1") {
    inds <- grep(colRE, col)
    vals <- sub(colRE, replacement, col)[inds]
    inds <- c(inds, length(col)+1)
    newCol <- rep(NA, length(col))
    class(newCol) <- class(vals)
    for (i in seq(along=vals)) {
        newCol[(inds[i]):(inds[i+1]-1)] <- vals[i]
    }
    newCol
}


This results in the following line in the corresponding .Rd file:
\usage{colAdder(col, colRE, replacement="\1")}

So we've lost one of the double back-slashes from the original (as
previously observed, in the released version, I was losing the quotes as
well - now fixed thanks).  Not a major issue - I can alter the file
manually obviously, but it would be nice to have the backslashes
preserved automatically.

Regards - Gavin

This communication is from Cancer Research UK. Our website is at www.cancerresearchuk.org. We are a charity registered under number 1089464 and a company limited by guarantee registered in England & Wales under number 4325234. Our registered address is 61 Lincoln's Inn Fields, London WC2A 3PX. Our central telephone number is 020 7242 0200.
 
This communication and any attachments contain information which is confidential and may also be privileged.   It is for the exclusive use of the intended recipient(s).  If you are not the intended recipient(s) please note that any form of disclosure, distribution, copying or use of this communication or the information in it or in any attachments is strictly prohibited and may be unlawful.  If you have received this communication in error, please notify the sender and delete the email and destroy any copies of it.
 
E-mail communications cannot be guaranteed to be secure or error free, as information could be intercepted, corrupted, amended, lost, destroyed, arrive late or incomplete, or contain viruses.  We do not accept liability for any such matters or their consequences.  Anyone who communicates with us by e-mail is taken to accept the risks in doing so.


More information about the Roxygen-devel mailing list