I would like to limit the number of lines that are produced from a function when I knit my markdown document in R. I've looked around quite a lot but can't find a solution.
My code is below, it gives 50+ lines of data when run. My goal is to only have 9 lines of code produced by the sedist function.
```{r, results=1:9}
sedist(FILENAME, method="correlation")
```
I have tried using {r, message=1:9}
, {r, Hide=1:9}
, {r, height=1:9}
, {r, results='hide'}
and similar.
When you press “Knit to PDF” in RStudio, it converts your R Markdown document into LaTeX. Download MiKTeX from here: https://miktex.org/download • Run the installer, and restart your computer. Open an R Markdown file in RStudio, and try knitting to PDF. You may be prompted to install some packages.
To change the output size you can use the corresponding LaTeX commands, set just before the code junk. The smallest option would be \tiny . For a full overview consider e.g. this. After the code junk it's important to set back to the size you used before, e.g. \normalsize .
To exit early from the knitting process, you may use the function knitr::knit_exit() anywhere in the source document (in a code chunk or inline expression). Once knit_exit() is called, knitr will ignore all the rest of the document and write out the results it has collected so far.
Something like this??
```{r R.options=list(max.print=10)}
df <- data.frame(x=1:100,y=1:100)
df
```
The R.options
chunk option in knitr
allows you to set any of R's options locally for that chunk. Look at ?options
for a list of the options you can set
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With