You may notice that I don’t have that many posts on my blog, and they are all about R.
The paucity of my posts makes me a bit sad, but not much, really…
What makes (or better, used to make me) sad is that posts of R code (used to) look awful.
However, your code doesn’t deserve and doesn’t need to be ugly. You can find online several beautifiers.
This page on Inside-R provides a useful tool. You just need to paste your R code in the provided form and paste it back in your page. Nice thing is that you get back HTML code so you can paste it in your blog, but also in your web site. Drawback: you get back a nearly unintelligible page full of html formatting in which your code is lost; to change even a single letter of code you will probably have to go back to your original function. You probably don’t need to edit your code now, but I got nervous about this for some strange reason. Thus, I looked for additional tools. I found out that WordPress now enables R syntax highlighting. I can assure you that it’s fairly easy (I did it!). Instructions are available on this R-bloggers page.
Since when I tried these two tools, I am an happy-R blogger!