# Given the text "I want cats", I'm trying to create the vector ("I see
cats","I grab cats","I obtain cats") by creating a function that takes a
vector with the words to change and applies to the initial text. However, I
get the error "dim(X) must have a positive length". Here is where I got:
desire<-"I want cats"
actions<-c("see","grab","obtain")
f<-function(x){
gsub("want", x, desire)
}
apply(actions,desire,f)
# Could you please help me? Thanks in advance
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-produce-variations-of-a-text-tp4726153.html
Sent from the datatable-help mailing list archive at Nabble.com.
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help