check_max_char: Check max length of strings in columns of a dataframe

Description Usage Arguments Value Examples

View source: R/short_generic.R

Description

Determine the maximum length of each set of strings in the columns of a dataframe. Non-character values will be reported as NA.

Usage

1
check_max_char(dat, return_names = c("col_name", "max_chars"))

Arguments

dat

a dataframe that can include a mix of datatypes

return_names

A vector of two names for the return dataframe.

Value

A dataframe reporting the max(nchar(0) of all columns in data. Non-character datatypes will return NA.

Examples

1
2
3
4
5
6
7
8
9
# Create example dataframe
fish_report = tibble::tibble(
  species = c("coho", "coho", "chin", "steelhead"),
  fish_method = c("Gillnet", "Seine", "Fish trap",
                  "Recreational angler"),
  total_length = c(660, 589, 815, 450))

# Report max length of strings in each column
fish_nchar = check_max_char(fish_report)

arestrom/remisc documentation built on July 16, 2020, 8:48 a.m.