Creating WordPress blog posts with RMarkdown

R Markdown

This blog post is written as an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.

I’ve use the RWordPress package and the instructions from this blog post:

https://cognitivedatascientist.com/tag/knit2wp/

#activate the necessary libraries
library(RWordPress)
library(knitr)
library(XMLRPC)
library(RCurl)

# tell RWordPress how to set the user name, password, and URL for your WordPress site.
options(WordPressLogin = c(n8thangreen20 = 'PASSWORD'),
        WordPressURL = 'https://healthdatacounts.wordpress.com/')

# tell knitr to create the html code and upload it to your WordPress site
knit2wp(input = "postname.Rmd",
        title = "posttitle",
        publish = FALSE,
        action = "newPost")

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: