Re: [R] What is wrong with this code?

From: Cable, Samuel B Civ USAF AFMC AFRL/RVBXI <Samuel.Cable_at_hanscom.af.mil>
Date: Wed, 30 Jun 2010 16:22:46 -0400

> > Anyway, I still wouldn't mind some advice on character
> > matching.
> > Thanks.
> >
> If so we need a reproducible example of what you are doing.

OK, let's say I have three strings. Str1="abc". Str2="abcd". Str3="efgh".

I want to compare Str1 and Str2 in such a way that R detects that Str2 indeed contains Str1. I want something that returns a "TRUE" value. Then I want to compare Str1 and Str3 so that R detects that Str3 does not contain Str1. I don't want it to give me an error because it can't find Str1. I just want to get a "FALSE" value. Is there a way to do this that's less messy than what I came up with? Thanks again.



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. Received on Wed 30 Jun 2010 - 20:25:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jun 2010 - 21:20:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive