[R] print method for str?

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Aug 26 17:40:54 CEST 2010


On Thu, 2010-08-26 at 10:42 +0200, David Hajage wrote:
> Hello useRs and guRus,
> 
> I was trying to add the support of str() in the ascii package, and I
> realized that str() does not have a print method. It uses cat() from inside
> the function and returns nothing.
> 
> Since it is not usual in R, I wonder why? Is there a particular reason?

The Value section of ?str has a (the?) reason. Efficiency.

str is an S3 generic though, so you can write your own methods for it.

HTH

G

> Thank you very much for your attention on... well, this unimportant
> question.
> 
> david
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list