2

When writing Rhtml documents you can utilize <!--rinline x --> to write inline code in the Rhtml document. However, this code is wrapped in <code class="inline knitr">x</code> which can wreck havoc on basic formatting.

Is there a way to remove this entirely? So that only x is written into the document.

1 Answer 1

5

I'm assuming you mean that only the output of what is stored in x is written into the document. You can get this by wrapping the expression in I().

Compare the differences in the output of this:

<html>

<head>
<title>Title</title>
</head>

<body>

<p>Test document</p>

<!--rinline x <- 3 -->

<!--rinline x -->

<!--rinline I(x) -->

</body>
</html>

This produces the following body:

<body>

<p>Test document</p>



<code class="knitr inline">3</code>

3

</body>

We can see that the first rinline gets the code tag while the second just inserts the output into the document directly.

Sign up to request clarification or add additional context in comments.

4 Comments

thanks, Dason, for explaining the "Luke, use the source" problem :)
Interesting, I had never even heard of I() before.
@BrandonBertelsen This is a good read if you're working with knitr - yihui.name/knitr/demo/output
Ack, I searched that page for RHTML not R HTML. :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.