2
4

1 回答 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.

于 2013-03-12T19:15:15.570 回答