Skip to content

project-spinoza/rblog

Repository files navigation

rblog

Example blog with RStudio, RMarkdown and Jekyll.

Prerequisits

Install R language, RStudio, Git Bash and Jekyll(Optional if using Github pages)

Install the latest version of the knitr package: install.packages("knitr")

Install other packages as per requirement, Like install.packages("ggplot2"); for drawing graphs etc.

Make a theme in Jekyll or use ready-made ones available here for your blog

Make a new repository in GitHub with a default branch of gh-pages and upload that jekyll theme in it

### Screenshot ![rblog screenshot](images/jekyll-themes.png)


## Cloning jekyll blog in RStudio
  • File, New project, Version control, Clone git
  • Repository URL :https://github.com/your repository
  • Project directory name : your project directory name
### Screenshots ![rblog screenshot](images/new-project.png)

![rblog screenshot](images/version-control.png)

![rblog screenshot](images/git.png)

![rblog screenshot](images/clone.png)

Publishing first post in your jekyll blog

New post can be added by two methods

1. User interface
2. Command line

### 1. User interface
  • First of all in RStudio goto Tools -> Project Project Options -> Sweave -> Select knitr is default option -> Ok
  • You have to download R Blog (Jekyll) template from here
  • Place r_blog directory in rmarkdown/rmarkdown/templates
  • After that goto File-> New File -> RMarkdown -> From Template -> Select a template R Blog (Jekyll)
  • After that add RMarkdown code in the newly created file save it in _posts directory of your blog with the name Y-M-D-title e.g 2016-08-24-blogtitle
  • As Jekyll supports markdown files, so you have to convert rmarkdown to markdown in RStudio by clicking Knit Html link
  • Now push only md files to github(if using gh-pages)
  • After that visit your blog and check the post
#### Screenshots ![rblog screenshot](images/default-option.png)

![rblog screenshot](images/rmarkdown.png)

![rblog screenshot](images/rblog-template.png)

![rblog screenshot](images/default-screen.png)

![rblog screenshot](images/output.png)




2. Command line

Making post from Command line requires some packages to install from RStudio console

  • install.packages(c("knitr", "servr", "devtools"))
  • devtools::install_github("hadley/lubridate")
  • devtools::install_github("brendan-r/brocks")
  • After installation brocks package will appear in Packages of RStudio
  • By clicking brocks the user can see all the functions which brocks provides
  • After that write library(brocks) on RStudio console and hit enter
  • For making post from console new_post(title = "new post", serve = TRUE, dir = "_source", subdir = TRUE, skeleton_file = ".skeleton_post")
    e.g new_post(title = "This is second blog", serve = TRUE, dir ="F:/GitHub/rblog/_posts", subdir = FALSE)
  • Write your rmarkdown code
  • Click knit html link, it will produce md file, push that md file to github
  • Visit your blog the post will appear


#### Screenshots ![rblog screenshot](images/brocks.png)

![rblog screenshot](images/brocks-functions.png)



## Final output ![rblog screenshot](images/screenshot.png)

About

Example blog with RStudio, RMarkdown and Jekyll

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published