sep_count: Count Separators for Separate_Gather

Description Usage Arguments Details Value Examples

View source: R/sep_count.R

Description

Count the number of separators in a column as the basis for the calculation of the number of columns to separate a column into using separate() in tidyr. Provides input to separate_gather

Usage

1
sep_count(data, col = "", sep = "[^[:alnum:]]+")

Arguments

data

A data frame

col

column containing separators to count

sep

separator

Details

Calculates the maximum number of separators in a column (typically ';'). When dividing values by a separator note that the final entry will not be marked by a separator. To address this the function uses +1. Caution should be exercised when using ',' as a separator when using person or organisation names containing this punctuation to separate first and second names etc.

Value

numeric count of separators

Examples

1
## Not run: sep_count(data, col = "authors", sep = ";")

poldham/oldhammisc documentation built on May 25, 2019, 11:23 a.m.