It looks like R is treating every character in the string as if it were decimal. I didn't see anything in the help file about "." being some kind of special character. Any idea why R is treating a decimal this way in these functions? Any suggestions how to get around this?
'.' is the regexpr character for matching any single character!
> regexpr("a.e", "Female.Alabama") [1] 4
To actually search for a dot, you need to 'escape' it with a backslash, but of course the backslash needs escaping itself, with another backslash. Luckily that backslash doesn't need escaping, otherwise we would quickly run out of patience.
> regexpr("\\.", "Female.Alabama") [1] 7
Baz
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help