string_to_table: Split character string into table

View source: R/utils.R

string_to_tableR Documentation

Split character string into table

Description

It takes a character string with names separated by comma (e.g. journal's names) and turns them into a table

Usage

string_to_table(x, n, split_regex = ", ?")

Arguments

x

string to split and convert to table

n

number of bucket to create. It will be the number of column in the resulting data.frame

split_regex

defaults to ⁠, ?⁠. Pass to split in base::strsplit().

Details

If the number of elements can't be split equally in the n column, blank cells will be created and all placed in the last column.

Value

a dataframe of n columns

Examples

string_to_table(paste(letters, collapse = ", "), 3)

rticles documentation built on May 31, 2023, 6:12 p.m.