I have a vector made up of multiple strings (in R):
vec <- c("the cat the cat ran up the tree tree", "the dog ran up the up the tree",
"the squirrel squirrel ran up the tree")
I need clean the duplicate words from each separate string.
Desired output:
"the cat ran up the tree"
"the dog ran up the tree"
"the squirrel ran up the tree"
I've tried the solution under: Removing duplicate words in a string in R . However this only conglomerates my multiple strings into a single complex string.