cols_condense() takes a spec object and condenses its definition by setting the default column type to the most frequent type and only listing columns with a different type. spec() extracts the full column specification from a tibble created by readr.

cols_condense(x)

spec(x)

Arguments

x

The data frame object to extract from

Value

A col_spec object.

Examples

df <- read_csv(readr_example("mtcars.csv"))
#> Error in read_csv(readr_example("mtcars.csv")): could not find function "read_csv"
s <- spec(df)
#> Error: inherits(x, "tbl_df") is not TRUE
s
#> Error in eval(expr, envir, enclos): object 's' not found
cols_condense(s)
#> Error in vapply(x$cols, function(xx) class(xx)[[1]], character(1)): object 's' not found