R Markdown代码块中的换行符

时间:2016-09-26 23:48:01

标签: r r-markdown line-breaks

我必须以R Markdown pdf格式输入统计数据。我能够成功地将我的答案转换为R Markdown文件,但是某些代码行不适合页面。

我必须打破的行类型如下所示:

    ```{r}
    gayssmw1 <- subset(gay, study == 1 & wave == 1 & treatment == "Same-Sex Marriage  Script by Gay Canvasser")
    mean(gayssmw1$ssm)
    gayssmstraightw1 <- subset(gay, study == 1 & wave == 1 & treatment == "Same-Sex  Marriage Script by Straight Canvasser")
    mean(gayssmstraightw1$ssm)
    gayssmcontrolw1 <- subset(gay, study == 1 & wave == 1 & treatment == "No Contact")
    mean(gayssmcontrolw1$ssm)
    mean(gayssmcontrolw1$ssm) - mean(gayssmw1$ssm)
    mean(gayssmcontrolw1$ssm) - mean(gayssmstraightw1$ssm)
    ```

我转回R Studio并开始在需要的地方首先插入换行符+ shift,然后尝试在R Markdown Basics网站上找到的双重空间。

现在这些行适合页面,但现在代码中此行中断所关注的所有结果都显示为:

    > gayssmw1 <- subset(gay, study == 1 & wave == 1 & treatment == "Same-Sex 
    Marriage Script by Gay Canvasser")
    > mean(gayssmw1$ssm)

    [1] NaN

等。

我该怎么办?

0 个答案:

没有答案