Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 707
Shankar Pandala Avatar asked Oct 02 '16 07:10

Shankar Pandala


People also ask

Can we see output in GitHub?

You can view the output generated during code scanning analysis in GitHub.com. If you have write permissions to a repository, you can view the code scanning logs for that repository. Code scanning is available for all public repositories on GitHub.com.

How do I show markdown output?

If you prefer to use the console by default for all your R Markdown documents (restoring the behavior in previous versions of RStudio), you can make Chunk Output in Console the default: Tools -> Options -> R Markdown -> Show output inline for all R Markdown documents .


1 Answers

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.

like image 54
hrbrmstr Avatar answered Oct 19 '22 13:10

hrbrmstr