[datatable-help] How to produce variations of a text?

quique3716 quique_3716 at hotmail.com
Wed Nov 2 19:56:05 CET 2016


# 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.


More information about the datatable-help mailing list