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')
Run the code above in your browser using DataLab