trim_content: Trim content

Description Usage Arguments Examples

View source: R/trim_content.R

Description

For easy kable-izing, take a sample of a dataframe and trim a single column (usually a long string)

Usage

1
trim_content(df, col = content, last_char = 50, sample_some = 3)

Arguments

df

Input dataframe

col

Unquoted column name of character column

last_char

Starting at character 1, how what's the last character that should be included.

sample_some

Number of rows to sample. If NULL, all rows are retained.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tbl <- janeaustenr::northangerabbey[100:109] %>%
  tibble::enframe() %>%
  dplyr::rename(
    content = value
  ) %>%
  dplyr::mutate(
    num = runif(10)
  )

tbl %>% trim_content(last_char = 5, sample_some = 7)

aedobbyn/dobtools documentation built on May 28, 2019, 2:33 a.m.