【发布时间】:2018-06-28 17:04:46
【问题描述】:
我想使用 R Markdown 打印对调查问题的开放式回复(任意长度的字符串),并且我希望所有回复都在同一个标题下。例如,问题“这位老师如何改进?”存储在名为d 的数据框中,并存储在名为x 的变量中。
这是一个例子:
---
title: "Teacher Survey"
output:
html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)
```
```{r}
d <- data.frame(id = (1:2), x =c("Test to see if word gets split: I kind
of think that for this teacher to improve they will have make a better
attempt to attend to the needs of all the students in the classroom",
"For this teacher to improve they will have make a better attempt to
attend to the needs of all the students in the classroom"),
stringsAsFactors = FALSE)
```
###How can this teacher improve
```{r comment=NA}
print(d$x)
```
第一个响应在第一行打印“bette”,在第二行打印“r”,而不是在一行上打印“better”。我怎样才能使它“更好”地打印在一行上?
【问题讨论】:
-
你的输出去哪儿了? (pdf、笔记本、html、word 等)。
-
输出为html。
-
你能提供一个minimal reproducible example吗?
标签: r r-markdown