setColNames.DTSg {DTSg}R Documentation

Set column names

Description

Changes the column names of DTSg objects.

Usage

## S3 method for class 'DTSg'
setColNames(
  x,
  cols = self$cols(class = "numeric")[1L],
  values,
  clone = getOption("DTSgClone"),
  ...
)

Arguments

x

A DTSg object (S3 method only).

cols

A character vector specifying the columns whose names shall be set. Another possibility is a character string containing either comma separated column names, for example, "x,y,z", or the start and end column separated by a colon, for example, "x:z". The name of the .dateTime column cannot be changed.

values

A character vector of the same length as cols specifying the desired column names. Another possibility is a character string containing comma separated column names, for example, "x,y,z".

clone

A logical specifying if the object shall be modified in place or if a deep clone (copy) shall be made beforehand.

...

Not used (S3 method only).

Value

Returns a DTSg object.

See Also

cols, getOption

Examples

# new DTSg object
x <- DTSg$new(values = flow)

# rename column "flow" to "River Flow"
## R6 method
x$setColNames(
  cols = "flow",
  values = "River Flow"
)$print()

## 'setnames()' is a "hidden" R6 alias for 'setColNames()'
x$setnames(
  cols = "flow",
  values = "River Flow"
)$print()

## S3 method
print(setColNames(
  x = x,
  cols = "flow",
  values = "River Flow"
))


[Package DTSg version 1.1.3 Index]