Martin Gartner
2009-Jun-06 08:35 UTC
[R] Rpad - avoid removal of manually created html-tags in R chunk
Dear Rpad-users, currently I am setting up a web page using Rpad (www.rpad.org). But I have a problem with generating dynamic html-output in the Rpad chunk. Here an example of my problem: I have the following index.html file: <html> <head> <title>example</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="gui/Rpad.js"></script> </head> <body> <pre dojoType="Rpad" rpadRun="init" rpadOutput="html" rpadHideSource="true"> x <- "<table><tr><th>A</th><th>B</th></tr><td>a</td><td>b</td></table>" </pre> </body> </html> If I run Rpad("index.html") in the local server mode and when I turn to my Rgui, then the object "x" looks like "ABab", i.e. all my html-tags are removed within the R-chunk. I know that I can avoid this with nested "HtmlTree"s, e.g. H("table", H("tr", H("th", "A"), H("th", "B")), H("tr", H("td", "a"), H("td", "b"))) but as I have to produce html-output of a large dataframe (100 rows and 6 colums), the nesting takes too much time (because every cell element might have conditional formatting and I have to check each element) and I think it would be faster with pasting all html-code manually into a character-object and printing this object as html. But trying this I have the above mentioned problem. Can anybody help me? If anybody knows a solution, how I can avoid, that the html-tags are removed from my "x" (see example above), I think, I can produce my output very fast. Thanks and best regards, Martin
Martin Gartner
2009-Jun-06 12:31 UTC
[R] Rpad - avoid removal of manually created html-tags in R chunk
Martin Gartner wrote:> Dear Rpad-users, > > currently I am setting up a web page using Rpad (www.rpad.org). But I > have a problem with generating dynamic html-output in the Rpad chunk. > Here an example of my problem: > > I have the following index.html file: > > <html> > <head> > <title>example</title> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> > <script type="text/javascript" src="gui/Rpad.js"></script> > </head> > <body> > <pre dojoType="Rpad" rpadRun="init" rpadOutput="html" > rpadHideSource="true"> > x <- > "<table><tr><th>A</th><th>B</th></tr><td>a</td><td>b</td></table>" > </pre> > </body> > </html> > > If I run Rpad("index.html") in the local server mode and when I turn > to my Rgui, then the object "x" looks like "ABab", i.e. all my > html-tags are removed within the R-chunk. > > I know that I can avoid this with nested "HtmlTree"s, e.g. > > H("table", H("tr", H("th", "A"), H("th", "B")), H("tr", H("td", "a"), > H("td", "b"))) > > but as I have to produce html-output of a large dataframe (100 rows > and 6 colums), the nesting takes too much time (because every cell > element might have conditional formatting and I have to check each > element) and I think it would be faster with pasting all html-code > manually into a character-object and printing this object as html. But > trying this I have the above mentioned problem. > > Can anybody help me? If anybody knows a solution, how I can avoid, > that the html-tags are removed from my "x" (see example above), I > think, I can produce my output very fast. > > Thanks and best regards, > Martin > > ______________________________________________ > 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. > >Hi everybody, I already got the solution. I have to use the encoded characters for the tags ... <html> <head> <title>GUI Examples</title> <script type="text/javascript"> rpadConfig = { gui: "alternate", rpadHideSource: true }; </script> <script type="text/javascript" src="gui/Rpad.js"></script> </head> <body> < > <pre dojoType="Rpad" rpadRun="init" rpadOutput="html" rpadHideSource="true"> x <- "<table border='1'><tr><th>A</th><th>B</th></tr><td>A</td><td>B</td></table>" cat(x) </body> </html> Best regards, Martin