Как расширить окно вывода текста? - PullRequest
0 голосов
/ 08 мая 2018

Я хочу напечатать вывод линейной смешанной модели и переносы текста. Есть ли вариант, который обходит эту проблему?

Я пробовал option(width=1000) и tidy=TRUE, tidy.opts=list(width.cutoff=600) безрезультатно.

EDIT: Вот минимальный воспроизводимый пример.

---
title: "Untitled"
author: "NickHayden"
date: "5/8/2018"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(lmerTest)
library(lme4)
library(tidyverse)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
df <- sample_n(diamonds, size = 100)
df <- df %>% mutate(randoms = rep(c("A","B", "C"), length.out = 100))
mod <- lmer(price ~  factor(color) * factor(clarity) * factor(cut) + (1|randoms), data = df)
print(summary(mod))
```

Здесь текст должен обернуться вокруг окна, и строки могут также обернуться под ним.

1 Ответ

0 голосов
/ 08 мая 2018

Альтернативой является экспорт вывода в текстовый файл. Следующая ссылка показывает, как этого добиться.

Экспорт вывода R в файл

Пример:

test <- c("asb", "asb", "asb", "abc")
out <- capture.output(summary(test))
cat("My title", out, file="example_output.txt", sep="\n", append=TRUE)
...