Re: [R] matching strings in a list

2015-07-17 Thread tryingtolearn
Thank you all very much! -- View this message in context: http://r.789695.n4.nabble.com/matching-strings-in-a-list-tp4709967p4710015.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] matching strings in a list

2015-07-16 Thread John McKown
On Thu, Jul 16, 2015 at 1:00 PM, John McKown wrote: > On Thu, Jul 16, 2015 at 12:40 PM, tryingtolearn > wrote: > >> Say I have a list: >> [[1]] "I like google" >> [[2]] "Hi Google google" >> [[3]] "what's up" >> >> and they are tweets. And I want to find out how many tweets mention google >> (th

Re: [R] matching strings in a list

2015-07-16 Thread John McKown
On Thu, Jul 16, 2015 at 12:40 PM, tryingtolearn wrote: > Say I have a list: > [[1]] "I like google" > [[2]] "Hi Google google" > [[3]] "what's up" > > and they are tweets. And I want to find out how many tweets mention google > (the answer should be 2). > If I string split and unlist them, then I

Re: [R] matching strings in a list

2015-07-16 Thread Ista Zahn
Why would you strsplit them? I would think length(grep("google", unlist(x), ignore.case = TRUE)) should do it. Best, Ista On Thu, Jul 16, 2015 at 1:40 PM, tryingtolearn wrote: > Say I have a list: > [[1]] "I like google" > [[2]] "Hi Google google" > [[3]] "what's up" > > and they are tweets. A

Re: [R] matching strings in a list

2015-07-16 Thread Marc Schwartz
> On Jul 16, 2015, at 12:40 PM, tryingtolearn wrote: > > Say I have a list: > [[1]] "I like google" > [[2]] "Hi Google google" > [[3]] "what's up" > > and they are tweets. And I want to find out how many tweets mention google > (the answer should be 2). > If I string split and unlist them,

[R] matching strings in a list

2015-07-16 Thread tryingtolearn
Say I have a list: [[1]] "I like google" [[2]] "Hi Google google" [[3]] "what's up" and they are tweets. And I want to find out how many tweets mention google (the answer should be 2). If I string split and unlist them, then I would get the answer of 3. How do I make sure I get just 2? --