R: Split Words

split_word {textshape} | R Documentation

## Split Words

### Description

Split words.

### Usage

    split_word(x, ...)

    ## Default S3 method:
    split_word(x, lower = TRUE, ...)

    ## S3 method for class 'data.frame'
    split_word(x, text.var = TRUE, lower = TRUE, ...)

### Arguments

`x` | A `data.frame` or character vector with words.
`lower` | logical. If `TRUE` the words are converted to lower case.
`text.var` | The name of the text variable. If `TRUE` `split_word` tries to detect the text column with words.
`...` | Ignored.

### Value

Returns a list of vectors of words or an expanded `data.table` with words split apart.

### Examples

    (x <- c(
        "Mr. Brown comes! He says hello. i give him coffee.",
        "I'll go at 5 p. m. eastern time.  Or somewhere in between!",
        "go there"
    ))
    split_word(x)
    split_word(x, lower=FALSE)

    data(DATA)
    split_word(DATA)
    split_word(DATA, lower=FALSE)

    ## Larger data set
    split_word(hamlet)

[Package textshape version 1.6.0 Index]