如何加宽文本的输出 window?
How to widen output window for text?
我想打印线性混合模型的输出和文本换行。
有解决这个问题的选项吗?
我试过option(width=1000)
和tidy=TRUE
,tidy.opts=list(width.cutoff=600)
都没有用。
编辑:
这是一个最小的可重现示例。
---
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))
```
这里的文字应该环绕 window 并且行也可以环绕在下面。
另一种方法是将输出导出到文本文件。下面的 link 展示了如何实现这一点。
示例:
test <- c("asb", "asb", "asb", "abc")
out <- capture.output(summary(test))
cat("My title", out, file="example_output.txt", sep="\n", append=TRUE)
我想打印线性混合模型的输出和文本换行。 有解决这个问题的选项吗?
我试过option(width=1000)
和tidy=TRUE
,tidy.opts=list(width.cutoff=600)
都没有用。
编辑: 这是一个最小的可重现示例。
---
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))
```
这里的文字应该环绕 window 并且行也可以环绕在下面。
另一种方法是将输出导出到文本文件。下面的 link 展示了如何实现这一点。
示例:
test <- c("asb", "asb", "asb", "abc")
out <- capture.output(summary(test))
cat("My title", out, file="example_output.txt", sep="\n", append=TRUE)