[R] problem with grep under loop

David Winsemius dwinsemius at comcast.net
Sat Sep 14 03:57:02 CEST 2013


Wrap a print or cat function around it.



Sent from my iPhone

On Sep 13, 2013, at 6:29 PM, capricy gao <capricyg at yahoo.com> wrote:

> 
> 
> I am just testing the possibility of using grep under for loop:
> 
>> for(i in 1:10){grep("a",letters)}
> 
> 
> nothing came out;
> 
> when I ran: 
> 
> 
>> grep("a",letters),
> 
> 
> I got "1"
> 
> so in my for loop, I expected to see ten "1"s, but I did not.
> 
> Could anybody help me to figure out why? Thanks a lot for your help.
> 
> Capricy
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list