On Mon, 24 Apr 2006, Prof Brian Ripley wrote:
> On Mon, 24 Apr 2006, Torsten Hothorn wrote:
>
> >
> > Dear developeRs,
> >
> > I thought that backslashes can be escaped in the usual way (and I think I
> > did this before) but I can't see why
> >
> > R> gsub("\\", "x", "\alpha")
> > Error in gsub(p
On Mon, 24 Apr 2006, Torsten Hothorn wrote:
>
> Dear developeRs,
>
> I thought that backslashes can be escaped in the usual way (and I think I
> did this before) but I can't see why
>
> R> gsub("\\", "x", "\alpha")
> Error in gsub(pattern, replacement, x, ignore.case, extended, fixed,
> useBytes)
\ is a special character in regular expressions so you need to
escape it as \\ but putting \\ between quotes give you only \
so you need to get \\. Any of these would work:
gsub("", "x", "\\alpha")
gsub("[\\]", "x", "\\alpha")
sub(".", "x", "\\alpha") # assumes \ is first character
gsub(
On Apr 24, 2006, at 10:23 AM, Torsten Hothorn wrote:
>
> Dear developeRs,
>
> I thought that backslashes can be escaped in the usual way (and I
> think I
> did this before) but I can't see why
>
> R> gsub("\\", "x", "\alpha")
> Error in gsub(pattern, replacement, x, ignore.case, extended, fixed
Dear developeRs,
I thought that backslashes can be escaped in the usual way (and I think I
did this before) but I can't see why
R> gsub("\\", "x", "\alpha")
Error in gsub(pattern, replacement, x, ignore.case, extended, fixed,
useBytes) :
invalid regular expression '\'
gives an error.