Dear group, There are postings on extracting partial string using sub()/gsub()/gsubfn() but I still couldn't figure this one out. Supposed I am pulling the synonyms of "help" using synonyms("help") from wordnet and get the followings:> synonyms("help")[1] "c(\"aid\", \"assist\", \"assistance\", \"help\")" [2] "c(\"aid\", \"assistance\", \"help\")" How can I get a one character string at the end that looks like this: [1] "aid" "assist" "assistance" "help" "aid" "assist" "help" Thanks for the help!!!!! Kelvin -- View this message in context: http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html Sent from the R help mailing list archive at Nabble.com.
Henrique Dallazuanna
2009-Aug-15 21:55 UTC
[R] extracting text from wordnet using synonym()
Try this: Str <- c("c(\"aid\", \"assist\", \"assistance\", \"help\")", "c(\"aid\", \"assistance\", \"help\")") unlist(sapply(Str, function(x)dget(textConnection(x)), USE.NAMES = FALSE)) On Sat, Aug 15, 2009 at 6:33 PM, Kelvin Lam <lamkelf@gmail.com> wrote:> > Dear group, > > There are postings on extracting partial string using sub()/gsub()/gsubfn() > but I still couldn't figure this one out. Supposed I am pulling the > synonyms of "help" using synonyms("help") from wordnet and get the > followings: > > > synonyms("help") > [1] "c(\"aid\", \"assist\", \"assistance\", \"help\")" > [2] "c(\"aid\", \"assistance\", \"help\")" > > How can I get a one character string at the end that looks like this: > > [1] "aid" "assist" "assistance" "help" "aid" "assist" "help" > > Thanks for the help!!!!! > > Kelvin > -- > View this message in context: > http://www.nabble.com/extracting-text-from-wordnet-using-synonym%28%29-tp24988275p24988275.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]