Skip to content

Using knitr to publish R syntax on Baylor’s WordPress/Edublog Posts

If you want to incorporate R syntax and output into your posts, it can be a little tricky. If you use knitr, this process can be made a little easier.

  1. Write your blog post in a Markdown document that includes your R syntax, save it as a .Rmd file (e.g., Post.Rmd)
  2. Install the markdown and knitr packages from your favorite CRAN mirror.

  1. Install the RWordPress package from

install.packages('RWordPress', repos = '', type = 'source')
  1. Use R to submit your .Rmd file as your post

# Log into your web page via R
options(WordPressLogin = c("First_Last" = 'password'), WordPressURL = '')
# have knitr compile your Rmd file and upload it to your web page
knit2wp('Post.Rmd', title = 'Post Title')
Published inR