data.table (version 1.0)

dimnames<-.data.table: ~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

dimnames<-.data.table(x, value)

Arguments

x
~~Describe x here~~
value
~~Describe value here~~

Value

  • ~Describe the value returned If it is a LIST, use
  • comp1Description of 'comp1'
  • comp2Description of 'comp2'
  • ...

Warning

....

Details

~~ If necessary, more details than the __description__ above ~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as ~~fun~~, ~~~

Examples

Run this code
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x, value)   # so that can do  colnames(dt)=<..>  as well as names(dt)=<..>
{
    if (!is.list(value) || length(value) != 2) stop("attempting to assign invalid object to dimnames of a data.table")
    if (!is.null(value[[1]])) stop("data.tables do not have rownames")
    if (ncol(x) != length(value[[2]])) stop("can't assign",length(value[[2]]),"colnames to a",ncol(x),"column data.table")
    names(x) <- as.character(value[[2]])
    x
  }

Run the code above in your browser using DataCamp Workspace