Re: [R] Select elements from text

2012-01-25 Thread mdvaan
Thanks. That worked great! -- View this message in context: http://r.789695.n4.nabble.com/Select-elements-from-text-tp4323947p4327711.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] Select elements from text

2012-01-24 Thread R. Michael Weylandt
paste(text, collapse = " ") Michael On Tue, Jan 24, 2012 at 3:41 PM, mdvaan wrote: > Thanks for the quick response. I get the latter part, but reading the text > from MS word into R is problematic. I am able to read in (scan) all unique > elements (following sep=" ") from the text, but unable to

Re: [R] Select elements from text

2012-01-24 Thread mdvaan
Thanks for the quick response. I get the latter part, but reading the text from MS word into R is problematic. I am able to read in (scan) all unique elements (following sep=" ") from the text, but unable to past everything together again. Any id on how to solve this? It looks like this now: text

Re: [R] Select elements from text

2012-01-24 Thread Justin Haynes
how bout using read.table(... , sep=" "). That would give you a vector of single words. then grepl("\\[[9-z]+\\]",x) will return a boolean vector > x<-c('test','[bracket]','hi]','[blah','foo','[bar]') > grepl('\\[[9-z]+\\]',x) [1] FALSE TRUE FALSE FALSE FALSE TRUE > x[grepl('\\[[9-z]+\\]',x

[R] Select elements from text

2012-01-24 Thread mdvaan
Hi, I have a series of MS word files and each file contains plain text. From these texts I would like to extract only those elements (read: words) that are between square brackets. Example of a text: Most fundamentally, it has led to an effort to clarify the organizational form concept. According