knitR, Markdown, and Your Homework

Want to try something new and interesting this week for your homework? There’s a great and not terribly difficult way to integrate your written responses to homework questions with R code and graphs without having to do a lot of copying and pasting. It’s an R library called knitr. Revolutions has a great introduction here with a wonderful 5 minute demo video.

I’ve been using knitr to generate slides as pdfs, but you can use knitr with markdown to make really nice html output that you can then print to pdf and send to me. Or you can get into LaTeX if you really want to jump off the deep end (and, hey, it’s how I’ve been writing your homeworks!

One thing I’ve really enjoyed is writing my code in a single file, then using code externalization to pull it into a document. It makes it easy to go back and forth between code and document.

Best of all, Rstudio makes all of this really really easy.

So, take a chance and try it out. There may be a few extra homework points in it for you!

Advertisements
This entry was posted in Course info, Links to outside reading. Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s