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 <[EMAIL PROTECTED]> > >> To: Zhen Pang <[EMAIL PROTECTED]> > >> CC: [EMAIL PROTECTED], [EMAIL PROTECTED] > >> 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, [EMAIL PROTECTED] > >> 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 > >> > >> ______________________________________________ > >> [EMAIL PROTECTED] mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide! > >> http://www.R-project.org/posting-guide.html > > > > > > ______________________________________________ > > [EMAIL PROTECTED] mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > > http://www.R-project.org/posting-guide.html > > ______________________________________________ > [EMAIL PROTECTED] 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, [EMAIL PROTECTED] 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 ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-devel