[R] How to get the string '\'?

Peng Yu pengyu.ut at gmail.com
Mon Nov 16 00:35:01 CET 2009


My question was from replacing a pattern by '\\'. How to replace '/'
in string by '\'?

string='abc/efg'
gsub('/','\\',string)

On Sun, Nov 15, 2009 at 5:07 PM, David Winsemius <dwinsemius at comcast.net> wrote:
> ?cat
>
>> cat("\\")
> \
>
>
> On Nov 15, 2009, at 5:30 PM, Peng Yu wrote:
>
>> I can not get the string '\'. Could somebody let me know how to get it?
>>
>>> print('\')
>>
>> +
>> +
>>>
>>> print('\\')
>>
>> [1] "\\"
>>
>> ______________________________________________
>> 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.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>




More information about the R-help mailing list