Dear developers, There's a small bug in print.fitdistr that can cause output to be printed twice, but only if print is called explicitly:> fit<-fitdistr(rt(1000,3),"t")There were 11 warnings (use warnings() to see them)> fitm s df -0.02181723 1.00145296 3.13723878 ( 0.03865057) ( 0.03999447) ( 0.33298377)> print(fit)m s df -0.02181723 1.00145296 3.13723878 ( 0.03865057) ( 0.03999447) ( 0.33298377) m s df -0.02181723 1.00145296 3.13723878 ( 0.03865057) ( 0.03999447) ( 0.33298377) Most likely, the function print.fitdistr doesn't return the input invisibly. Cheers, Enrico [[alternative HTML version deleted]]
On 09/02/2008 11:33 AM, Enrico Rossi wrote:> Dear developers, > > There's a small bug in print.fitdistr that can cause output to be printed > twice, but only if print is called explicitly: > >> fit<-fitdistr(rt(1000,3),"t") > There were 11 warnings (use warnings() to see them) >> fit > m s df > -0.02181723 1.00145296 3.13723878 > ( 0.03865057) ( 0.03999447) ( 0.33298377) >> print(fit) > m s df > -0.02181723 1.00145296 3.13723878 > ( 0.03865057) ( 0.03999447) ( 0.33298377) > m s df > -0.02181723 1.00145296 3.13723878 > ( 0.03865057) ( 0.03999447) ( 0.33298377) > > Most likely, the function print.fitdistr doesn't return the input invisibly.That's a correct analysis, but fitdistr is in MASS, so the report should go to Brian Ripley, the maintainer. I've cc'd him. I did a quick look through other print methods using this code: for (name in methods("print")) { fn <- do.call("getAnywhere", list(name))$objs[[1]] body <- body(fn) len <- length(body) cat(name, ": ", deparse(body[[len]]), "\n") } and turned up a few other cases in base packages; I'll fix them as appropriate. Duncan Murdoch
On 09/02/2008 11:33 AM, Enrico Rossi wrote:> Dear developers, > > There's a small bug in print.fitdistr that can cause output to be printed > twice, but only if print is called explicitly: > >> fit<-fitdistr(rt(1000,3),"t") > There were 11 warnings (use warnings() to see them) >> fit > m s df > -0.02181723 1.00145296 3.13723878 > ( 0.03865057) ( 0.03999447) ( 0.33298377) >> print(fit) > m s df > -0.02181723 1.00145296 3.13723878 > ( 0.03865057) ( 0.03999447) ( 0.33298377) > m s df > -0.02181723 1.00145296 3.13723878 > ( 0.03865057) ( 0.03999447) ( 0.33298377) > > Most likely, the function print.fitdistr doesn't return the input invisibly.I've fixed a number of instances of this kind of thing in the base packages now. A related kind of error I also fixed were print methods that returned an invisible NULL, or something other than what was printed. I didn't touch the recommended packages. These fixes are in R-patched now. Duncan Murdoch