Shankar Pandala Shankar Pandala - 2 months ago 15
R Question

How can i see output of .rmd in github?

I am practicing data analysis using R programming. I want my files to be on github. I am unable to figure out why github is not showing the output of .rmd files.

Here is the link to the file in my github repository Data Analysis Practice

I want the output including plots to be shown on github.

Answer

Instead of:

output: html_document

make it:

output: rmarkdown::github_document

(assuming you have the latest rmarkdown installed which you should if you're using RStudio — which I suspect you are — and keep it updated or update packages regularly).

It will create Exploring_one_variable.md and render the images as files.

When you browse to that markdown file, the images will render.

An alternative is to use:

output: 
  html_document:
    keep_md: true

and it will render to both Exploring_one_variable.md and Exploring_one_variable.html so you'll have the best of both worlds without the local github-esque preview that the former provides.

You can get fancier and put something like the following as the first code section in the Rmd:

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

which will put the figures in a directory of your choosing.

You can see this in action here as the README.md was generated with knitr from the README.Rmd in the same directory.