Re: [Rd] Comments in the DESCRIPTION file

From: William Dunlap <wdunlap_at_tibco.com>
Date: Fri, 07 Dec 2012 00:53:03 +0000

Why not just use some tag that R doesn't already use, say "Comment:", instead of a #? If you allow # in position one of a line to mean a comment then people may expect # to be used as a comment anywhere on a line.

(It may also mess up some dcf parsing code that I've written - it checks that lines after tagged lines are either empty, the start of a new description, or start with a space, a continuation of the previous line.)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> -----Original Message-----
> From: r-devel-bounces_at_r-project.org [mailto:r-devel-bounces_at_r-project.org] On Behalf
> Of Hervé Pagès
> Sent: Thursday, December 06, 2012 3:47 PM
> To: Duncan Murdoch
> Cc: christophe.genolini_at_u-paris10.fr; r-devel_at_r-project.org; Christophe Genolini
> Subject: Re: [Rd] Comments in the DESCRIPTION file
>
>
>
> On 12/06/2012 03:41 PM, Hervé Pagès wrote:
> > Hi,
> >
> > Wouldn't be hard to patch read.dcf() though.
> >
> > FWIW here's the "comment aware" version of read.dcf() I've been using
> > for years:
> >
> > .removeCommentLines <- function(infile=stdin(), outfile=stdout())
> > {
> > if (is.character(infile)) {
> > infile <- file(infile, "r")
> > on.exit(close(infile))
> > }
> > if (is.character(outfile)) {
> > outfile <- file(outfile, "w")
> > on.exit({close(infile); close(outfile)})
> > }
> > while (TRUE) {
> > lines <- readLines(infile, n=25000L)
> > if (length(lines) == 0L)
> > return()
> > keep_it <- substr(lines, 1L, 1L) != "#"
> > writeLines(lines[keep_it], outfile)
> > }
> > }
> >
> > read.dcf2 <- function(file, ...)
> > {
> > clean_file <- file.path(tempdir(), "clean.dcf")
>
> mmh, would certainly be better to just use tempfile() here.
>
> H.
>
> > .removeCommentLines(file, clean_file)
> > on.exit(file.remove(clean_file))
> > read.dcf(clean_file, ...)
> > }
> >
> > Cheers,
> > H.
> >
> > On 11/07/2012 01:53 AM, Duncan Murdoch wrote:
> >> On 12-11-07 4:26 AM, Christophe Genolini wrote:
> >>> Hi all,
> >>>
> >>> Is it possible to add comments in the DESCRIPTION file?
> >>
> >>
> >> The read.dcf function is used to read the DESCRIPTION file, and it
> >> doesn't support comments. (The current Debian control format
> >> description does appear to support comments with leading # markers, but
> >> R's read.dcf function doesn't support these.)
> >>
> >> You could probably get away with something like
> >>
> >> #: this is a comment
> >>
> >> since unrecognized fields are ignored, but I think this fact is
> >> undocumented so I would say it's safer to assume that comments are not
> >> supported.
> >>
> >> Duncan Murdoch
> >>
> >> ______________________________________________
> >> R-devel_at_r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages_at_fhcrc.org
> Phone: (206) 667-5791
> Fax: (206) 667-1319
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 07 Dec 2012 - 00:59:04 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Dec 2012 - 07:42:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive