Returns all column names of a DTSg object, those of certain classes,
modes, typeofs and/or those matching a certain pattern only.
Usage
# S3 method for class 'DTSg'
cols(x, class = NULL, pattern = NULL, mode = NULL, typeof = NULL, ...)Arguments
- x
A
DTSgobject (S3 method only).- class
An optional character vector matched to the most specific class (first element) of each column's
classvector. The “special class”".numerary"matches theintegerandnumericclasses.- pattern
An optional character string passed on to the
patternargument ofgrep.- mode
An optional character vector matched to each column's
mode.- typeof
An optional character vector matched to each column's
typeof.- ...
Further arguments passed on to
grep. Thevalueargument is rejected.
Examples
# new DTSg object
x <- DTSg$new(values = flow)
# get names of numeric columns
## R6 method
x$cols(class = "numeric")
#> [1] "flow"
## 'names()' is an R6 alias for 'cols()'
x$names(class = "numeric")
#> [1] "flow"
## S3 method
cols(x = x, class = "numeric")
#> [1] "flow"