About this blog or How to blog directly from R markdown to WordPress

I started this blog for several reason. First of all, I want to use it as a motivation for practising the R programming language and try new R features. I discovered R years ago at work and I’m since then exploring the endless possibilities of this programming language (or programme, or both?), although there are quite a lot of ups and downs doing this. Unfortunately, I’m not able to spend as much time in training and exploring as I want, but I hope this will get better by writing this blog.

I decided to publish my experiences, since the R-community is pretty awesome and teached me anything I know today about R (even if there were some – probably justified – harsh comments on my clumsy entries in forums…). Especially participating in courses at coursera.org, contributions at stack overflow and entries at R-bloggers teached and helped me uncountable times. Now I feel that it is time to give back a bit of this to other users.

What you can expect from this blog

I’ll use this blog to test packages or functions I never used before, try things seen on R-bloggers and analyse data which are interesting to me. I’ll also include the code by blogging directly from R markdown, which should be my contribution to the community. Thus, this first entry will include an instruction for blogging directly from R to WordPress.

How to blog directly from R to WordPress

Blogging directly from R to WordPress is actually simpler than I expected. Doing this with R markdown enables me to include my code as well as text, pics etc in a comfortable way. Below you can find the code which has to run in order to actually blog your R markdown document (the template was found here, very useful was also the contribution here):

options(WordPressLogin = c(insert_your_username = 'insert_password'), WordPressURL = 'https://insert_domain.wordpress.com//xmlrpc.php')

# Knitr options: upload plots/images to wordpress
opts_knit$set(upload.fun = function(file){library(RWordPress);uploadFile(file)$url;})

# enable toc (comment out if not needed)
options(markdown.HTML.options =  c(markdownHTMLOptions(default = T),"toc"))

postid <- knit2wp('01_About_this_blog.Rmd', action = c("newPost"), title = 'About this blog', categories=c('R'), mt_keywords = c('R', 'RMarkdown', 'data analysis'), publish = TRUE) # add featured image include: wp_post_thumbnail=postThumbnail$id 

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s