1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/col_types.R
3\name{cols}
4\alias{cols}
5\alias{cols_only}
6\title{Create column specification}
7\usage{
8cols(..., .default = col_guess())
9
10cols_only(...)
11}
12\arguments{
13\item{...}{Either column objects created by \verb{col_*()}, or their abbreviated
14character names (as described in the \code{col_types} argument of
15\code{\link[=read_delim]{read_delim()}}). If you're only overriding a few columns, it's
16best to refer to columns by name. If not named, the column types must match
17the column names exactly.}
18
19\item{.default}{Any named columns not explicitly overridden in \code{...}
20will be read with this column type.}
21}
22\description{
23\code{cols()} includes all columns in the input data, guessing the column types
24as the default. \code{cols_only()} includes only the columns you explicitly
25specify, skipping the rest. In general you can substitute \code{list()} for
26\code{cols()} without changing the behavior.
27}
28\details{
29The available specifications are: (with string abbreviations in brackets)
30\itemize{
31\item \code{col_logical()} [l], containing only \code{T}, \code{F}, \code{TRUE} or \code{FALSE}.
32\item \code{col_integer()} [i], integers.
33\item \code{col_double()} [d], doubles.
34\item \code{col_character()} [c], everything else.
35\item \code{col_factor(levels, ordered)} [f], a fixed set of values.
36\item \code{col_date(format = "")} [D]: with the locale's \code{date_format}.
37\item \code{col_time(format = "")} [t]: with the locale's \code{time_format}.
38\item \code{col_datetime(format = "")} [T]: ISO8601 date times
39\item \code{col_number()} [n], numbers containing the \code{grouping_mark}
40\item \code{col_skip()} [_, -], don't import this column.
41\item \code{col_guess()} [?], parse using the "best" type based on the input.
42}
43}
44\examples{
45cols(a = col_integer())
46cols_only(a = col_integer())
47
48# You can also use the standard abbreviations
49cols(a = "i")
50cols(a = "i", b = "d", c = "_")
51
52# You can also use multiple sets of column definitions by combining
53# them like so:
54
55t1 <- cols(
56  column_one = col_integer(),
57  column_two = col_number()
58)
59
60t2 <- cols(
61  column_three = col_character()
62)
63
64t3 <- t1
65t3$cols <- c(t1$cols, t2$cols)
66t3
67}
68\seealso{
69Other parsers:
70\code{\link{col_skip}()},
71\code{\link{cols_condense}()},
72\code{\link{parse_datetime}()},
73\code{\link{parse_factor}()},
74\code{\link{parse_guess}()},
75\code{\link{parse_logical}()},
76\code{\link{parse_number}()},
77\code{\link{parse_vector}()}
78}
79\concept{parsers}
80