I have been looking for an easy way to publish my data analysis results from RStudio directly to WordPress. In this way I can save time editing my post. I tried the package “RWordPress”. It is ablt to transfer my R file as a post draft into my WordPress account. The code and the results are coming up nicely. However, the R plots did not show up correctly. Apparently, you have to upload the png files manually in to your wordpress.
There are simply 5 steps to publish your Rmd file as your post.
Step 1: Set up the working directory
## Set the working directory to the file you are going to publish setwd("D:/R/Shiny")
Step 2: Install packages “RWordPress” and “knitr”
## These two packages are necessary library(knitr) library(RWordPress) ## In case your packages are not working well, these packages are pre-works library(XMLRPC) library(RCurl) library(reshape2) library(bitops)
Step 3: Fill up your login details for your WordPress account
## Login your wordpress, give your username, your password and your wordpress website URL (don't forget to add the /xmlrpc.php after your website address) options(WordPressLogin = c(username = 'password'), WordPressURL = 'https://example.com/xmlrpc.php')
Step 4: Publish a new post draft
## Import your Rmd file to your wordpress as a draft, replace the FileName with your real filename, replace the PostTitle with your real post title. knit2wp('FileName.RmD', title = 'PostTite', publish = FALSE, action = "newPost")
Step 5: Update the draft in R
## You can check your post draft now. To update your draft from R, just replace the PostID with your real post ID number (where you can find out form your wordpress drafts) knit2wp('FileName.RmD', title = 'PostTitle', publish = FALSE, action = 'editPost', postid = PostID)
What I found is that there are still many works to do after transfering the R knit file into wordpress. I guess that is why many people are working on other methods to generate the website content from RStudio.