

   row/colnames {base}                          R Documentation

   RRooww aanndd CCoolluummnnnn NNaammeess

   DDeessccrriippttiioonn::

        Retrieve or set the row or column names of an object
        (the first or second component of its `dimnames').

   UUssaaggee::

        rownames(x, do.NULL = TRUE, prefix = "row")
        rownames(x) <- namevector

        colnames(x, do.NULL = TRUE, prefix = "col")
        colnames(x) <- namevector

   DDeettaaiillss::

        If `do.NULL' is `FALSE', a character vector (of length
        `NROW(x)' or `NCOL(x)' is returned in any case,
        prepending `prefix' to simple numbers, if `dim-
        names(x)[[i]]' (`i =' 1 or 2) is `NULL'.

   SSeeee AAllssoo::

        `dimnames', `case.names', `variable.names'.

   EExxaammpplleess::

        m0 <- matrix(NA, 4, 0)
        m2 <- cbind(1,1:4)
        rownames(m0)

        colnames(m2, do.NULL = FALSE)
        colnames(m2) <- c("x","Y")
        rownames(m2) <- rownames(m2, do.NULL = FALSE, prefix = "Obs.")
        m2

