I am producing an HTML output but I am having issues with the output width of R code output.
I'm able to adjust the figure width with no difficulty but when I try to write a data table or the factor loadings, R is outputting at a fixed width which is only about a third of my screen width. This results in the columns of the table being split up rather than all of the columns displayed in a single table.
Here is a reproducible example:
--- output: html_document --- # Title ```{r echo = FALSE, fig.width=16, fig.height=6} x = matrix(rnorm(100),ncol=10) x plot(x) ```
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 transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
tabset-fade} . The tabs within that group are created by level 3 headers ( ### ). To close down the tabbed section, it is necessary to introduce a new level 1 or 2 header. Please note it is VERY IMPORTANT to include a blank line before a new tabbed section begins.
Put this at the top (but below the YAML) of your rmarkdown document: Don't put it in a chunk but as plain text. It should set the max-width of the content area to 1800px.
You can also build books, websites, and interactive documents with R Markdown. Each output format is implemented as a function in R. You can customize the output by passing arguments to the function as sub-values of the output field.
Sometimes the text output printed from R code may be too wide. If the output document has a fixed page width (e.g., PDF documents), the text output may exceed the page margins. See Figure 5.1for an example.
If the output document has a fixed page width (e.g., PDF documents), the text output may exceed the page margins. See Figure 5.1for an example. The R global option widthcan be used to control the width of printed text output from some R functions, and you may try a smaller value if the default is too large.
Add this at the start of your document:
```{r set-options, echo=FALSE, cache=FALSE} options(width = SOME-REALLY-BIG-VALUE) ```
Obviously, replace SOME-REALLY-BIG-VALUE with a number. But do you really want to do all that horizontal scrolling?
Your output is probably being wrapped somewhere around 80 characters or so.
Also, you can temporarily change the local R options for a code chunk:
```{r my-chunk, R.options = list(width = SOME-BIG-VALUE)} ```
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