13

I would like to be able to write some R code in markdown (including images), compile it with knitr, and publish it into wordpress (including uploading the images to the blog, not as text in the post). All from R.

I am thinking that RWordPress might have some useful tools for the job, though it wasn't updated for about two years now.

Do you think this is "easily" possible? Does any of you have any suggestions regarding this? Any lead will be appreciated.

(p.s: This question is my holy-grail of the year)

7
  • 2
    Not directly related to your question, but if you are an emacs user, org-mode and org-babel allow you to do just that (not in markdown, though), and org2blog provides a way to publish directly on a Wordpress blog via the XML-RPC interface.
    – juba
    Commented Feb 2, 2013 at 10:46
  • If you can write html into your newPost, I don't see why this would be a problem. Once you knit your markdown document, it will make a .html. From there, you can strip out all the non-essential html and push it as part of a post. Commented Feb 2, 2013 at 12:12
  • 1
    Maybe this is of use: carlboettiger.info/2012/02/28/… Commented Feb 2, 2013 at 14:04
  • 1
    of all the solutions I have seen so far, this one is probably the closest: wkmor1.wordpress.com/2012/07/01/… I might add a new function knit2wp() into knitr v1.1 after I have done some tests on RWordPress; images can be uploaded to Imgur by knitr::imgur_upload(). If anyone wants to contribute, please feel free to send pull requests :)
    – Yihui Xie
    Commented Feb 2, 2013 at 23:51
  • 1
    Here is another blogging solution from R Markdown, different from Wordpress. ramnathv.github.com/poirotBlog/about.html. It is still in beta.
    – Ramnath
    Commented Feb 3, 2013 at 3:52

1 Answer 1

3

Please test the development version (v1.0.10) of knitr and see if this works: http://yihui.name/knitr/demo/wordpress/

4
  • Has wordpress changed how their XML-RPC api works with R because functions such as knit2wp (knitr) give me the following error: Error: faultCode: 401 faultString: Sorry, you are not allowed to publish posts on this site. Commented Aug 11, 2016 at 5:50
  • I get the same error using uploadFile or newPost from RWordpress Commented Aug 11, 2016 at 17:14
  • I get the same problem Commented Jul 17, 2017 at 21:25
  • I won't support WordPress any more. Please consider blogdown: github.com/rstudio/blogdown
    – Yihui Xie
    Commented Jul 18, 2017 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.