Including R Code in a Blog Post
This post discusses ways of including formatted code in a blog post.
I often write posts that include computer code. This might be R code, SPSS syntax, an Inquisit script, or a Visual Basic Macro.
Initially I did not know how to include this code in a neat form in my posts. The layout was ugly. The font was ugly. And even worse, certain special characters such as the greater than symbol caused particular problems and would sometimes crash my blog.
I still don’t feel like I’ve found the perfect solution, but I now use the following procedure:
- Take the code and use Greg Houston‘s web script to generate the HTML
- Press Edit HTML in Blogger in the post; use control + F to find the insertion point; paste the HTML from step 1.
offers daily e-mail updates
news and tutorials
on topics such as: Data science
, Big Data, R jobs
, visualization (ggplot2
), programming (RStudio
, Web Scraping
) statistics (regression
, time series
) and more...
If you got this far, why not subscribe for updates
from the site? Choose your flavor: e-mail
, or facebook