0

I have a document in RMarkdown where I want to display an output from a function. Because the output table is too big, however, the output always shows with a linebreak, like this:

enter image description here

I want the table to continue in one line and fill the whole width of the document. There is a lot of space on the right that the output box could extend to.

This is my reproducible example code. I made the variables extremely long on purpose to demonstrate the problem. I also added the legend on the side as this demonstrates the problem as well.

---
title: "rEproDUciBle ExamPle"
output:
  html_document:
    number_sections: true
    toc: true
    toc_float: true
    toc_depth: 1
---

# x
## x
## x
# x
## x
```{r }
#install.packages("MatchIt")
library(MatchIt)
data("mtcars")
names(mtcars) <- c("longlonglonglonglongword1longlonglonglonglongword1", "longlonglonglonglongword1longlonglonglonglongword2", NA, NA, NA, NA, NA, "longlonglonglonglongword1longlonglonglonglongword9")

a1 <- matchit(longlonglonglonglongword1longlonglonglonglongword9 ~ longlonglonglonglongword1longlonglonglonglongword1 + longlonglonglonglongword1longlonglonglonglongword2, mtcars,
              method = "nearest", distance = "mahalanobis",ratio = 1,replace = FALSE, std.caliper = TRUE, caliper = c(longlonglonglonglongword1longlonglonglonglongword2 = 0.1)) 
```
## x
```{r }
options(width = 200)
summary(a1) 
```
Karoline
  • 19
  • 4
  • 1
    Can you tell us what you want to happen instead of the output going on to a new line? – nrennie Mar 23 '23 at 18:50
  • thanks for the comment, I added it to the description. – Karoline Mar 23 '23 at 21:36
  • Whether or not there is extra space in the margin to the right depends what size of screen you're viewing the HTML document on. One option is to add a scroll bar, another would be to make the text smaller, or look at using CSS to change max width. See: https://stackoverflow.com/questions/36845178/width-of-r-code-chunk-output-in-rmarkdown-files-knitr-ed-to-html/36846864#36846864 – nrennie Mar 23 '23 at 22:19

0 Answers0