col_skip {minty} | R Documentation |
Create column specification
Description
cols()
includes all columns in the input data, guessing the column types
as the default. cols_only()
includes only the columns you explicitly
specify, skipping the rest. In general you can substitute list()
for
cols()
without changing the behavior.
Usage
col_skip()
cols(..., .default = col_guess())
cols_only(...)
Arguments
... |
Either column objects created by |
.default |
Any named columns not explicitly overridden in |
Details
The available specifications are: (with string abbreviations in brackets)
-
col_logical()
[l], containing onlyT
,F
,TRUE
orFALSE
. -
col_integer()
[i], integers. -
col_double()
[d], doubles. -
col_character()
[c], everything else. -
col_factor(levels, ordered)
[f], a fixed set of values. -
col_date(format = "")
[D]: with the locale'sdate_format
. -
col_time(format = "")
[t]: with the locale'stime_format
. -
col_datetime(format = "")
[T]: ISO8601 date times -
col_number()
[n], numbers containing thegrouping_mark
-
col_skip()
[_, -], don't import this column. -
col_guess()
[?], parse using the "best" type based on the input.
Value
a list / S3 object representing column specification
See Also
Other parsers:
parse_datetime()
,
parse_factor()
,
parse_guess()
,
parse_logical()
,
parse_number()
,
parse_vector()
Other parsers:
parse_datetime()
,
parse_factor()
,
parse_guess()
,
parse_logical()
,
parse_number()
,
parse_vector()
Examples
cols(a = col_integer())
cols_only(a = col_integer())
# You can also use the standard abbreviations
cols(a = "i")
cols(a = "i", b = "d", c = "_")
# You can also use multiple sets of column definitions by combining
# them like so:
t1 <- cols(
column_one = col_integer(),
column_two = col_number()
)
t2 <- cols(
column_three = col_character()
)
t3 <- t1
t3$cols <- c(t1$cols, t2$cols)
t3