Learn R Programming

rticles (version 0.27)

string_to_table: 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 = ", ?")

Value

a dataframe of n columns

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.

Examples

Run this code
string_to_table(paste(letters, collapse = ", "), 3)

Run the code above in your browser using DataLab