Re: [R] How to remove $ (Dollar sign) from string

2012-04-22 Thread Giuseppe Marinelli
In data martedì 10 aprile 2012 13:34:13, Nevil Amos ha scritto: How do I remove a $ character from a string sub() and gsub() with $ or \$ as pattern do not work. sub($,,ABC$DEF) [1] ABC$DEF sub(\$,,ABC$DEF) Error: '\$' is an unrecognized escape in character string starting \$

Re: [R] How to remove $ (Dollar sign) from string

2012-04-22 Thread Patrick Burns
Why you need a double backslash is alluded to in Circle 8.1.23 of 'The R Inferno'. http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Pat On 22/04/2012 10:18, Giuseppe Marinelli wrote: In data martedì 10 aprile 2012 13:34:13, Nevil Amos ha scritto: How do I remove a $ character from a

[R] How to remove $ (Dollar sign) from string

2012-04-10 Thread Nevil Amos
How do I remove a $ character from a string sub() and gsub() with $ or \$ as pattern do not work. sub($,,ABC$DEF) [1] ABC$DEF sub(\$,,ABC$DEF) Error: '\$' is an unrecognized escape in character string starting \$ sub(\$,,ABC$DEF) Error: unexpected input in sub(\ Thanks -- Nevil Amos Molecular

Re: [R] How to remove $ (Dollar sign) from string

2012-04-10 Thread John Fox
Dear Nevil, You have the escape the backslash: sub(\\$, , ABC$DEF) [1] ABCDEF I hope this helps, John John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada

Re: [R] How to remove $ (Dollar sign) from string

2012-04-10 Thread Ted Harding
On 10-Apr-2012 11:34:13 Nevil Amos wrote: How do I remove a $ character from a string sub() and gsub() with $ or \$ as pattern do not work. sub($,,ABC$DEF) [1] ABC$DEF sub(\$,,ABC$DEF) Error: '\$' is an unrecognized escape in character string starting \$ sub(\$,,ABC$DEF) Error: unexpected

Re: [R] How to remove $ (Dollar sign) from string

2012-04-10 Thread Ivan Calandra
Hi, Try with a double back slash: sub(\\$,,ABC$DEF) HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr http://biogeosciences.u-bourgogne.fr/calandra Le 10/04/12 13:34,

Re: [R] How to remove $ (Dollar sign) from string

2012-04-10 Thread Gabor Grothendieck
On Tue, Apr 10, 2012 at 7:34 AM, Nevil Amos nevil.a...@monash.edu wrote: How do I remove a $ character from a string sub() and gsub() with $ or \$ as pattern do not work. sub($,,ABC$DEF) [1] ABC$DEF sub(\$,,ABC$DEF) Error: '\$' is an unrecognized escape in character string starting \$