In some cases it may be useful to write a WordPress post in R Markdown and afterwards publish it to my blog. This can be done using the RWordPress package. First we setup a link to my blog: if (!require(‘RWordPress’)) install.packages(‘RWordPress’, repos = ‘http://www.omegahat.org/R’, type = ‘source’) library(RWordPress) options(WordPressLogin = c(<your username> = ‘<your password>’), WordPressURL = ‘https://www.research.relund.dk/wp/xmlrpc.php’) Next the post is written in a Rmd file and afterwards published to WordPress: id<-knit2wp(‘RWordPress_post.Rmd’, title = ‘Publishing R markdown to WordPress’, categories = c(‘R’), publish=F ) Now the post with id is a draft on my blog and I can have a look at it before publishing it. If I want to update the post I do: knit2wp(‘RWordPress_post.Rmd’, title = ‘Publishing R markdown to WordPress’, postid=id, action=’editPost’, categories = c(‘R’), publish = F ) To highlight the above code I use the WP Code Highlight.js plugin. If you use other syntax highlight […]
I recent migrated my R package mdp from my R-forge svn repo to GitHub. Do the following: Create an empty folder mdp and open a shell and import the svn to git (I only imported the pkg sub-folder svn+ssh://email@example.com/svnroot/mdp/pkg) git svn clone svn+ssh://firstname.lastname@example.org/svnroot/mdp/pkg . # import the svn git branch -a # info, should show a git-svn remote branch git svn info # show svn details (also URL) Now add your local repo to GitHub. First, create an empty GitHub repo and next run from the shell: git remote add origin https://github.com/relund/mdp.git git push -u origin master The first line tells Git that your local repo has a remote version on GitHub, and calls it “origin”. The second line pushes all your current work to that repo. Now you have a local Git repo and 2 remote repos (one at GitHub and one at R-forge). You want to use GitHub as […]
I have started to use Git and GitHub together with RStudio. Git is a distributed version control system which is very useful when doing reproducible research. It is a good way to handle programming/coding. Moreover, Git (via GitHub) allows groups of people to work on the same documents (often code) at the same time, and without stepping on each other’s toes. RStudio is an excellent integrated development environment built specifically for R.