From hkawakat at gmail.com  Thu Sep 23 15:05:20 2010
From: hkawakat at gmail.com (Hiroyuki Kawakatsu)
Date: Thu, 23 Sep 2010 14:05:20 +0100
Subject: [Rd] R CMD Rprof --help suggestion
Message-ID: <AANLkTikY6HvY5M5DKj8grH+5AMtGyy0aBK1vKPeUz=Tb@mail.gmail.com>

Hi,

>From reading ?Rprof, I checked
R CMD Rprof --help
and learned that there are options to specify the min % to print. This
is currently (R-devel r52975) displayed with the --help option as

  --min%total           minimum % to print for 'by total'
  --min%self            minimum % to print for 'by self'

So I tried
R CMD Rprof --min%total 5
and got an error. After looking at the source, I find that I need to do
R CMD Rprof --min%total=5

Can I suggest a change in (R_SOURCE/src/library/tools/R/Rprof.R) the
--help option display for --min%total and --min%self to something like

  --min%total=NUM       set NUM as minimum % to print for 'by total'
  --min%self=NUM        set NUM as minimum % to print for 'by self'

which I think is more in line with e.g. R --help.

PS 1: ?Rprof states that R CMD Rprof is a Perl script but that no
longer seems to be the case. The remark in ?summaryRprof about it
being slower than R CMD Rprof for large files no longer applies?

PS 2: summaryRprof() currently does not appear to support these min %
options. I find them quite useful so I would like to request them to
be added. By looking at how .Rprof() post-processes summaryRprof(), a
quick hack I use is

summaryRprof2 <- function(..., mintotal=-1L, minself=-1L) {
  res <- utils::summaryRprof(...)
  if (mintotal>0) res$by.total <-
res$by.total[res$by.total[,"total.pct"]>=mintotal,]
  if (minself>0) res$by.self <- res$by.self[res$by.self[,"self.pct"]>=minself,]
  return(res)
}

h.
-- 
+---
| Hiroyuki Kawakatsu
| Business School, Dublin City University
| Dublin 9, Ireland. Tel +353 (0)1 700 7496



[Rd] R CMD Rprof --help suggestion
Hiroyuki Kawakatsu