[R] sprintf doesn't care of escape characters
jholtman at gmail.com
Mon Jul 30 20:15:18 CEST 2012
sprintf is working just fine. Your problem is the interpretation of
what the results are. Displaying the object will show the escape
characters, but if you use "cat", or output to a file, you will see
that the result is correct:
> cat( sprintf("a\nb"))
On Mon, Jul 30, 2012 at 1:29 PM, Edwin Helbert Aponte Angarita
<helbert2a at gmail.com> wrote:
> I am having trouble with something that should be simple. I am unable
> to get sprintf using escape sequences:
>  "a\nb"
>  "a\"bc\"d"
> But it seems to need them any way:
> Error: unexpected symbol in "sprintf("a\"bc"d"
> Any suggestion on how to solve this issue?
> My R system:
> platform x86_64-suse-linux-gnu
> arch x86_64
> os linux-gnu
> system x86_64, linux-gnu
> major 2
> minor 15.0
> year 2012
> month 03
> day 30
> svn rev 58871
> language R
> version.string R version 2.15.0 (2012-03-30)
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
More information about the R-help