R: Remove Punctuation Marks from a Text Document

removePunctuation {tm} | R Documentation

## Remove Punctuation Marks from a Text Document

### Description

Remove punctuation marks from a text document.

### Usage

    ## S3 method for class 'character'
    removePunctuation(x, preserve_intra_word_dashes = FALSE)
    ## S3 method for class 'PlainTextDocument'
    removePunctuation(x, ...)

### Arguments

`x` | A character or text document.
`preserve_intra_word_dashes` | a logical specifying whether intra-word dashes should be kept.
`...` | passed over argument `preserve_intra_word_dashes`.

### Value

The character or text document `x` without punctuation marks (besides intra-word dashes if `preserve_intra_word_dashes` is set).

### See Also

`getTransformations` to list available transformation (mapping) functions.

`regex` shows the class `[:punct:]` of punctuation characters.

### Examples

    data("crude")
    crude[[14]]
    removePunctuation(crude[[14]])
    removePunctuation(crude[[14]], preserve_intra_word_dashes = TRUE)

[Package tm version 0.7-1 Index]