cols_type {xefun} | R Documentation |
columns by type
Description
The columns name of a data frame by given data types.
Usage
cols_type(dt, type)
Arguments
dt |
a data frame. |
type |
a string of data types, available values including character, numeric, double, integer, logical, factor, datetime. |
Examples
dt = data.frame(a = sample(0:9, 6), b = sample(letters, 6),
c = Sys.Date()-1:6, d = Sys.time() - 1:6)
dt
# numeric columns
cols_type(dt, 'numeric')
# or
cols_type(dt, 'n')
# numeric and character columns
cols_type(dt, c('character', 'numeric'))
# or
cols_type(dt, c('c', 'n'))
# date time columns
cols_type(dt, 'datetime')
[Package xefun version 0.1.5 Index]