EDIT: This question was poorly thought out. My issue is actually with simply trying to display the text via shiny - not storing it. Somedays you just don't think clearly.
I have a python script that prints some results to stdin that I would like to read into a character vector in R. This generally works great using system(...,intern=TRUE), however in this case it does not work for me when escape characters are added on (the script returns HTML and adding escape characters can lead to malformed HTML). I can get around this by saving the output from python into a temporary file and reading that file into R, but I'd rather avoid that if there is an easy fix that I can't think of. Here is an example of what I mean:
> #f.py is a text file containing
>
> # #!/usr/bin/python
> #
> # html = """
> # <HTML>
> # <p>some content</p>
> # <p> some more content </p>
> # </HTML>"""
> #
> # print html
>
> #the /t, among other escapes, break the html
> v1 <- paste(system("./f.py",intern=TRUE),collapse="")
> v1
[1] "\t\t<HTML>\t\t\t<p>some content</p>\t\t \t<p> some more content </p>\t\t</HTML>"
>
> #this is what I want... but it needs to be saved into an object
> system("./f.py")
<HTML>
<p>some content</p>
<p> some more content </p>
</HTML>
> #or equivalently
> cat(v1)
<HTML> <p>some content</p> <p> some more content </p> </HTML>
>
> #I thought capture.output() would work, but the string still has the escaped characters
> v2 <- capture.output(cat(v1))
> v2
[1] "\t\t<HTML>\t\t\t<p>some content</p>\t\t \t<p> some more content </p>\t\t</HTML>"
paste()imported from (or is it your own function?)system()(from os import systemwould let you invoke it like that though commonly it is invoked likeos.system()) that does the same thing (though with different arguments) and a module calledpastethough with no functionality likeR's paste. Your first sentence is clear. I don't knowRbut could it be representing tab characters as\tand not actually populating the string with `\` and `t`?