我怎样才能在github中看到.rmd的输出?

时间:2016-10-02 07:42:45

标签: r github rstudio r-markdown

我正在使用R编程进行数据分析。我希望我的文件在github上。我无法弄清楚为什么github没有显示.rmd文件的输出。

以下是我的github存储库Data Analysis Practice

中文件的链接

我希望包含绘图的输出显示在github上。

1 个答案:

答案 0 :(得分:42)

而不是:

output: html_document

制作:

output: rmarkdown::github_document

(假设您安装了最新的rmarkdown,如果您正在使用RStudio,我应该这样做 - 我怀疑您是 - 并保持更新或定期更新软件包。)

它将创建Exploring_one_variable.md并将图像渲染为文件。

当您浏览到该降价文件时,图像将呈现。

另一种方法是使用:

output: 
  html_document:
    keep_md: true

它将呈现给Exploring_one_variable.mdExploring_one_variable.html,因此,如果没有前者提供的本地github-esque预览,您将拥有两全其美的优势。

你可以变得更加漂亮,并将以下内容作为Rmd中的第一个代码部分:

```{r, echo = FALSE}
knitr::opts_chunk$set(
  fig.path = "README_figs/README-"
)
```

将数字放在您选择的目录中。

您可以在here中看到这一点,因为README.md是使用knitr从同一目录中的README.Rmd生成的。{/ p>