>>>>> "PaulG" == Paul Gilbert
<pgilbert@bank-banque-canada.ca> writes:
MM> COLNAMES <- function(x)
MM> if(is.null(n <- colnames(x))) paste(seq(length=NCOL(x))) else
n
MM> ROWNAMES <- function(x)
MM> if(is.null(n <- rownames(x))) paste(seq(length=NCOL(x))) else
n
MM> Do you have any positive or negative thoughts on this?
PaulG> Here are a few thoughts.
thank you!
PaulG> 0/ In ROWNAMES use NROW
oh yes !
PaulG> 1/ You might try do this in some way that generalizes more
PaulG> easily to arrays, but I'm not sure how.
this would mean DIMNAMES, presumably.
PaulG> 2/ You might want paste("col", seq(length=NCOL(x)))
instead of
PaulG> just the numbers.
Not directly;
In the places I've seen a possible use,
sometimes there was "var", sometimes "..." (forgotten),
sometimes no
prefix at all.
However, we could add an optional argument `prefix',
even with sensible defaults:
COLNAMES <- function(x, prefix = "col")
if(is.null(n <- colnames(x)))
paste(prefix, seq(length=NCOL(x)), sep="") else n
ROWNAMES <- function(x, prefix = "row")
if(is.null(n <- rownames(x)))
paste(prefix, seq(length=NROW(x)), sep="") else n
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._