returns a count table of string lengths for a character column. The helper function choose_strlen
filters dataframe for rows containing specific string length for the specified column.
confirm_strlen(mdb, col)
choose_strlen(cs_output, len)
dataframe
unquoted column
dataframe. output from confirm_strlen
integer vector.
prints a summary and returns a dataframe invisibly dataframe with original columns, filtered to the specific string length
iris %>%
tibble::as_tibble() %>%
confirm_strlen(Species) -> iris_cs_output
#> Species_chr_len n percent
#> 6 50 33.3%
#> 9 50 33.3%
#> 10 50 33.3%
iris_cs_output
#> # A tibble: 150 × 6
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species Species_chr_len
#> <dbl> <dbl> <dbl> <dbl> <fct> <int>
#> 1 5.1 3.5 1.4 0.2 setosa 6
#> 2 4.9 3 1.4 0.2 setosa 6
#> 3 4.7 3.2 1.3 0.2 setosa 6
#> 4 4.6 3.1 1.5 0.2 setosa 6
#> 5 5 3.6 1.4 0.2 setosa 6
#> 6 5.4 3.9 1.7 0.4 setosa 6
#> 7 4.6 3.4 1.4 0.3 setosa 6
#> 8 5 3.4 1.5 0.2 setosa 6
#> 9 4.4 2.9 1.4 0.2 setosa 6
#> 10 4.9 3.1 1.5 0.1 setosa 6
#> # … with 140 more rows
iris_cs_output %>%
choose_strlen(6)
#> # A tibble: 50 × 6
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species Species_chr_len
#> <dbl> <dbl> <dbl> <dbl> <fct> <int>
#> 1 5.1 3.5 1.4 0.2 setosa 6
#> 2 4.9 3 1.4 0.2 setosa 6
#> 3 4.7 3.2 1.3 0.2 setosa 6
#> 4 4.6 3.1 1.5 0.2 setosa 6
#> 5 5 3.6 1.4 0.2 setosa 6
#> 6 5.4 3.9 1.7 0.4 setosa 6
#> 7 4.6 3.4 1.4 0.3 setosa 6
#> 8 5 3.4 1.5 0.2 setosa 6
#> 9 4.4 2.9 1.4 0.2 setosa 6
#> 10 4.9 3.1 1.5 0.1 setosa 6
#> # … with 40 more rows