as.text.table | R Documentation |
Convert a data.table column of character vectors into a column with one row per word grouped by a grouping column. Optionally will split a column of strings into vectors of constituents.
as.text.table(x, text, split = NULL, group_by = NULL)
x |
A data.table. |
text |
A string, the name of the column in x containing text to un-nest. |
split |
A string with a pattern to split the text in text column into constituent parts. |
group_by |
A vector of column names to group by. Doesn't work if the group by column is a list column. |
A data.table, text column un-nested to one row per word.
as.text.table( x = as.data.table( list( col1 = c( "a", "b" ), col2 = c( tolower("The dog is nice because it picked up the newspaper."), tolower("The dog is extremely nice because it does the dishes.") ) ) ), text = "col2", split = " " )