If the statistics are boring, then you've got the wrong numbers. Edward R. Tufte
How to create your very first post with Rmarkdown and Knitr
Written on October 1, 2016 by hoanguc3m
We usually write a lot of codes everyday. However, most of them are commands and not commented properly. As the consequence, it might take a lot of time to understand our own writing when we review them some months later.
Fortunately, Rmarkdown is an useful tool to create a reproducible research. In order to start writing a readable document. First you need to choose from the menu: File -> New File -> R markdown
From the new pop-up, choose the file type you want and click OK and you will have a new document that is ready to be modified.
You could click on the Knit button in the menu bar to see how thing looks like.
Some examples
Here I include some examples from ggplot2:
Iris data
We plot the iris data as follows:
How about a regression line
Publish to github respository
Now we want to share our work as a blog post. We need to convert the Rmd file into md file in order for jekyll to understand.
First please add this instruction to the Rmarkdown header
And also we could create tag to the post as
We have something like this
We also need to separate the figure generated by the Rmarkdown, so try this one
Now you have the md file together with all the images in the img folder. Let’s upload to github folder.