R: Set the Names in an Object

SetNames {DescTools} | R Documentation

## Set the Names in an Object

### Description

This is a convenience function that sets the names on an object and returns the object. It is most useful at the end of a function definition where one is creating the object to be returned and would prefer not to store it under a name just so the names can be assigned. In addition to the function `setNames` the user can decide, whether rownames, colnames or simply the names are to be set.

### Usage

    SetNames(x, ...)

### Arguments

`x` | an object for which a names attribute will be meaningful
`...` | the names to be assigned to the object. This should be a character vector of names named `rownames`, `colnames` or `names`. Setting `rownames=NULL` would remove existing rownames. All kind of names can be changed at the same time.

### Value

An object of the same sort as object with the new names assigned.

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

`setNames`, `Rename`

### Examples

    tab <- table(d.pizza$driver, d.pizza$wine_delivered)
    SetNames(BinomCI(tab[,1], rowSums(tab)), rownames=rownames(tab))

[Package DescTools version 0.99.26 Index]