get_col_types: Extract and Display Column Types of a Data Frame or Tibble

View source: R/CodeAndRoll2.R

get_col_typesR Documentation

Extract and Display Column Types of a Data Frame or Tibble

Description

This function returns the primary class/type of each column in a data frame or tibble. Additionally, it can print a summary of the column types.

Usage

get_col_types(df, print_it = TRUE)

Arguments

df

A data frame or tibble whose column types are to be extracted.

print_it

Logical; if TRUE (default), prints a table of column types and a summary.

Value

A named character vector where names are column names and the values are their respective primary types.

Examples

df <- data.frame(a = 1:3, b = c("A", "B", "C"), c = factor(c("X", "Y", "X")))
get_col_types(df)


vertesy/CodeAndRoll2 documentation built on Nov. 20, 2024, 5:23 a.m.