Missing horizontal scrollbar in R Markdown HTML snippets and output

How can I make my knitted .Rmd document not wrap code when creating an HTML document? Whenever I attach my file, I get the output as follows:

Not what I want ...

You can see that the first line containing the call cbindis wrapped. This was created by the following Rmd code. Basically, I would like to see that the resulting HTML file looks like it is here in StackOverflow (i.e. with a horizontal scrollbar).

---
title: "Title"
author: "Author"
date: "March 25, 2016"
output: html_document
---

```{r}
myveryveryveryveryverylongvariablenameanditsdataaaaaaaaaaaaaaaaaaaaaaaaaaa <- cbind(iris, iris, iris, iris, iris, iris, iris)
head(myveryveryveryveryverylongvariablenameanditsdataaaaaaaaaaaaaaaaaaaaaaaaaaa )
```

Then separately, how to do this to display text in the second line? I tried options(width=...), but it just seems to be more annoying to the conclusion. I would like it to look the same as here in StackOverflow (without wrapping with a horizontal scrollbar):

  Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length Petal.Width Species Sepal.Length Sepal.Width Petal.Length Petal.Width
1          5.1         3.5          1.4         0.2  setosa          5.1         3.5          1.4         0.2  setosa          5.1         3.5          1.4         0.2  setosa          5.1         3.5          1.4         0.2
2          4.9         3.0          1.4         0.2  setosa          4.9         3.0          1.4         0.2  setosa          4.9         3.0          1.4         0.2  setosa          4.9         3.0          1.4         0.2
3          4.7         3.2          1.3         0.2  setosa          4.7         3.2          1.3         0.2  setosa          4.7         3.2          1.3         0.2  setosa          4.7         3.2          1.3         0.2
4          4.6         3.1          1.5         0.2  setosa          4.6         3.1          1.5         0.2  setosa          4.6         3.1          1.5         0.2  setosa          4.6         3.1          1.5         0.2
5          5.0         3.6          1.4         0.2  setosa          5.0         3.6          1.4         0.2  setosa          5.0         3.6          1.4         0.2  setosa          5.0         3.6          1.4         0.2
6          5.4         3.9          1.7         0.4  setosa          5.4         3.9          1.7         0.4  setosa          5.4         3.9          1.7         0.4  setosa          5.4         3.9          1.7         0.4
+4
1

. :

  • .Rmd YAML:

    css: report_styles.css

    :

    pre, code {white-space:pre !important; overflow-x:scroll !important}

    , . , , .

  • , chunk, , options(width=a-big-number) this question.

+4

All Articles