Well, I have been at it since the last 3 days I guess. Starting from Wednesday I have been working on one single task - " How to get R content on to my blog "

I had to learn Sweave which took about 2 days in between trading pairs. Sweave introduced me to noweb which is the syntax used to embed R code in simple latex type file . This syntax is very easy to learn and was first introduced under the name “literate programming”. After struggling for a bit, I understood that Sweave works on files under the extension .Rnw which are nothing but documents with R code and text. Sweave creates tex files on which you can run latex commands to create ps or pdf files. I got this loop worked out . In the future whenever I have produce documents with R graphs I can easily do them using the combination of .Rnw files + noweb syntax + Sweave + Latex.

What I was looking though was something to post on to wordpress. I came across a few tools in my path.

Asciidoc which converts txt files to html which can then be ported to wordpress using blogpost, a python script. Asciidoc needs python and takes in a txt file. Ok, here was my learning. I had to take the .Rnw file , use a R package called ascii , and first convert the .Rnw file to a text file which is ready to be input in to asciidoc.

So, I downloaded Python 3.1 and played around with the syntax. I did not want to learn a bunch of stuff relating to Python. All I wanted to know was to upload a blog post. So, I started used IDLE which was a little painful as there was some learning curve. Suddenly i stumbled on showmedo.com where there was a video which mentioned about Beginning Python book. I immediately went gigapedia downloaded the book and it showed by clearly how to run python script from DOS prompt…wow! what else do I need?

So, started running asciidoc when I realized (google forum on python post ) that asciidoc is not compatible with python 3.1 ..Hence had to uninstall 3.1 and install 2.6

Asciidoc worked like a charm with Python 2.6

Now coming to the posting part. Had to use blogpost a python script.

  • Download from Mercurial repository at ShareSource.
  • Put blogpost.py in search path (optional).
  • Create $HOME/.blogpost configuration file (see example conf/blogpost_example.conf).
  • Disable emoticons from the WordPress browser interface (optional):
    • Login.
    • Navigate to Settings?Writing?Writing Settings page.
    • Uncheck Convert emoticons in the Formatting section (this option stops the automatic conversion of text patterns to emoticons).

I tried for about 2 hours to create the config file that is necessary to post a ascill generated file!
and finally the command in this file helped me..
www.r-bloggers.com/wordpress-blogging-with-r-in-3-steps-2/

python blogpost.py create –conf blogpost.conf test4.txt

If I have to write an instruction manul after spending 5 days on it, here would be the steps involved :

  • Download Python 2.6 and not a version later than that. So, browse through the archives
  • Append the environment variables path variable to point to python folder
  • Download asciidoc Extract it to some folder : C:\Cauldron\garage\asciidoc
  • Download blogpost from the reposition : C:\Cauldron\garage\blogpost
  • Download Sweave package
  • Download ascii package
  • Go to eclipse StatET and cofigure sweave settings
  • Create a new Sweave file
  • Insert the r code with noweb syntax
  • create an text file using ascii
  • Upload to wordpress blog

Some of the useful links are :

blog.raamdev.com/2009/01/24/blogging-from-the-command-line
srackham.wordpress.com/blogpost1/
srackham.wordpress.com/blogpost-readme/
www.r-bloggers.com/wordpress-blogging-with-r-in-3-steps-2/
srackham.wordpress.com/category/weblog-client/