Drop links or images here to add them to the editor.

Split the strings in the character vector into words, removing any commas or hyphens (no need to store the result in an object):

x <- c("Swan swam over the pond, Swim swan swim!",
    "Swam swam back again - Well swum swan!")

(from: Cotton, 2013, Learning R, O’Reilly)