Proposal for discussion: COLNAMES & ROWNAMES

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Mon, 9 Nov 1998 15:34:35 +0100


Looking into several different parts of  R../src/library/base/R/*.R
has led me to the conclusion
that quite a bit of code doubling could be saved by using the following two
functions whose naming philosophy is derived from that of  NROW() & NCOL():

  COLNAMES <- function(x)
      if(is.null(n <- colnames(x))) paste(seq(length=NCOL(x))) else n
  ROWNAMES <- function(x)
      if(is.null(n <- rownames(x))) paste(seq(length=NCOL(x))) else n

Do you have any positive or negative thoughts on this?
[a negative one that I had: ``yet another set of such *names functions !'']
Maybe, replying only to me -- who then would summarize -- is okay.

Martin
Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum SOL G1;	Sonneggstr.33
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1086			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._