[Rd] Re: Question on Rprof(); was: Re: [R] sapply and loop

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 19 Oct 2004 - 18:10:29 EST


Uwe: moved to R-devel.

Good point (and also happens on Unix). But lack of write permission will also give a fatal error, and the right place to fix this is in src/main/eval.c which has

        R_Suicide("can't open profile file");

and should I think throw a non-fatal error.

Brian

On Tue, 19 Oct 2004, Uwe Ligges wrote:

> Zhen Pang wrote:
>
> > I am sorry for neglecting the acknowledgement for `Writing R
> > Extensions', since I think I am just citing the code from the orignal
> > R-help. I fail to get the results when I use my own code. So I refer to
> > this code where Rprof() appears. Anyway, I am sorry for this.
> >
> > In fact, I have tried to whether I specify boot.out. Neither one works.
>
> Do you have read/write permissions? R-1.8.1 is pretty old. Please upgrade.
>
>
>
> BTW: Rprof() to a non-existing directory
> Rprof("c:/DoesNotExist/temp.out")
> under R-2.0.0, Windows, results in the GUI information message:
> "Fatal error: can't open profile file", and R is closed afterwards.
>
> I think we should change this behaviour to a simple error message by
> adding the lines
>
> if(!file.exists(dirname(filename)))
> stop("Cannot open file ", filename)
>
> just before
>
> invisible(.Internal(Rprof(filename, append, interval)))
>
>
>
> Uwe Ligges
>
>
>
> > Rprof("boot.out")
> > storm.boot <- boot(rs, storm.bf, R = 4999) # pretty slow
> > Rprof(NULL)
> >
> > summaryRprof()
> > Error in summaryRprof() : no events were recorded
> >
> > summaryRprof("boot.out")
> > Error in summaryRprof("boot.out") : no events were recorded
> >
> > Rprof()
> > storm.boot <- boot(rs, storm.bf, R = 4999) # pretty slow
> > Rprof(NULL)
> >
> > summaryRprof()
> > Error in summaryRprof() : no events were recorded
> >
> >
> > Zhen
> >
> >
> >> From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
> >> To: Zhen Pang <nusbj@hotmail.com>
> >> CC: tlumley@u.washington.edu, r-help@stat.math.ethz.ch
> >> Subject: Re: [R] sapply and loop
> >> Date: Tue, 19 Oct 2004 07:29:54 +0100 (BST)
> >>
> >> On Tue, 19 Oct 2004, Zhen Pang wrote:
> >>
> >> > I tried to use Rprof(). As an example, I consider the following code
> >> (from
> >> > Venables & Ripley, 1999).
> >>
> >> I believe you parroted that from `Writing R Extensions', but failed to
> >> give proper credit!
> >>
> >> > library(MASS); library(boot); library(nls)
> >> > data(stormer)
> >> > storm.fm <- nls(Time ~ b*Viscosity/(Wt - c), stormer,
> >> > start = c(b=29.401, c=2.2183))
> >> > st <- cbind(stormer, fit=fitted(storm.fm))
> >> > storm.bf <- function(rs, i) {
> >> > st$Time <- st$fit + rs[i]
> >> > tmp <- nls(Time ~ (b * Viscosity)/(Wt - c), st,
> >> > start = coef(storm.fm))
> >> > tmp$m$getAllPars()
> >> > }
> >> > rs <- scale(resid(storm.fm), scale = FALSE) # remove the mean
> >> > Rprof("boot.out")
> >> > storm.boot <- boot(rs, storm.bf, R = 4999) # pretty slow
> >> > Rprof(NULL)
> >>
> >> At this point your unacknowledged copying went adrift.
> >>
> >> > summaryRprof()
> >> > Error in summaryRprof() : no events were recorded
> >> >
> >> > I am using R1.8.1 in windows. Why can't I get the results?
> >>
> >> Because you didn't do your homework, and didn't even follow your source.
> >> The 'file' arguments of Rprof and summaryProf have to agree: see their
> >> help pages (as the posting guide asks).
> >>
> >> --
> >> Brian D. Ripley, ripley@stats.ox.ac.uk
> >> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> >> University of Oxford, Tel: +44 1865 272861 (self)
> >> 1 South Parks Road, +44 1865 272866 (PA)
> >> Oxford OX1 3TG, UK Fax: +44 1865 272595
> >>
> >> ______________________________________________
> >> R-help@stat.math.ethz.ch mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide!
> >> http://www.R-project.org/posting-guide.html
> >
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue Oct 19 18:15:51 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:22 EST