About
This blog is an open source project. You cannot only use the source code of this blog and use it for other purposes but you also can contribute.
Contribute
As this blog is stored on Github and open source, you can either contribute to this blog or use it for your personal belongings on another domain (e.g. through Github page). For both ways you get started, you need to fork the magnusmetz.github.io repository to your own Github account (click the Fork
button). You are assumed to have basic knowledge of GIT and R.
New Article
To start a new article, run
rake post title="A Title"
and you will get an R Markdown (Rmd) file under _source/
named yyyy-mm-dd-a-title.Rmd
, which is a plain text file and you can edit it with your favorite text editor. At the moment, RStudio has the best support for Rmd files. Here is an Rmd sample file and its output.
If you do not have or understand rake
, just copy an existing Rmd file, rename and open it with a text editor.
Edit an Article
There are a few fields in the header such as author
and tags
; if you have multiple entries, use the comma to separate them, e.g. author: [taiyun, yihui]
. Note all authors need to put their information in _config.yml
, and input the author id’s to the author
field (the same applies to reviewers).
You can write math in the LaTeX syntax, e.g. $$\alpha+\beta$$
in a paragraph renders inline like , and $$f(x)=\frac{1}{\sqrt{2\pi}}e^{-x^2/2}$$
in a separate paragraph renders the display style
If you want to generate animations, set animation: true
in the preamble of the article and use the chunk option fig.show='animate'
in the chunk header (example).
Compilation
The executable script _bin/knit
is essentially an R script. For Linux/Mac users, you can compile an Rmd file to md by
./_bin/knit _source/yyyy-mm-dd-your-post.Rmd
For Windows users, use Rscript
instead:
Rscript ./_bin/knit _source/yyyy-mm-dd-your-post.Rmd
You can certainly preview the article inside your editor like RStudio, and the above approach is necessary only when you are ready to submit the article. Do not worry about images – we will compile your article again after it is accepted, and images will be re-generated and stored in the right place.
Preview
If you want to preview your articles locally (http://localhost:4000), you can run
jekyll serve
Of course you need to install Jekyll first.
Submission
After you are done with an article, commit it to your forked repository and submit a pull request to us. We will get it reviewed and you will see comments online. Further revisions may be required, in which case you just make the revision and continue to commit in the changes, and they will appear in the previous pull request.
Please commit the source file only (*.Rmd
) and do not commit the output files (*.md
and figures). We will re-compile the source files and upload images after we accept the article. Therefore if your article involves special packages or data, you should add clear instructions on them in the article.
Reviewers
Everyone is welcome to become a reviewer for this blog. Reviews are public in the pull requests on Github. There are no anonymous reviewers here.