R

Compile multiple (r)markdown files

Introduction to Math for Political Scientists, AKA “Math Camp,” starts on Monday. The class is an absolute blast to teach, but that’s not the subject of the post. I’ve made the slides for the course in rmarkdown because I mix math and R code together.1 I can then export them fairly easily to pdf slides via the rmarkdown package, which relies on pandoc to convert the markdown to latex and then compile the latex.

Intro to R course at GU

Mapping your travels with R

I’ve always wanted one of those wall maps that you can push pins into to show where all you’ve been. However, with college and grad school and whatnot, I’ve never really had the energy to put one up, since I know I’ll just have to take it down the next time I move. Then, something occurred to me: I like maps. I like traveling. I like R. So why not spend a night putting them all together?

Analyzing a resolution to read more

Lots of little things happen in grad school that take you by surprise but really shouldn’t. One of those things for me happened after I finished all of my coursework. Without the deadlines of weekly seminars, I didn’t read journal articles or books nearly as often as I should have. I figured this out about this time last year and made it my New Year’s resolution to get better at keeping up with journals.

Maybe as Numeric

I submitted final course grades today. The semester is over, hurrah! Of course, getting the grades out of my university’s learning management system (we use Canvas) was a pain. It exported to csv, but the first three rows contained some meta-information instead of students’ grades. And there were some rows that weren’t students. So this meant that when I imported this into R, all the columns in my data.frame were of type character instead of numeric:

Combining Code and Writing

Combining code and the document that you’re writing is called “literate programming”. It’s one of the best practices associated with reproducible research, which is a hot topic in political science and other disciplines. This post isn’t about why you should do this, it’s just about how to do it. I’m going to talk about how to combine R code with markdown via rmarkdown and LaTeX via knitr. There are other ways of doing this (such as org-mode in emacs), so this isn’t supposed to be a comprehensive guide to all of the ways of doing this.

Emacs with LaTeX for Academic Writing

Having a super powerful text editor can make your life much easier. There are quite a few out there, but there’s only that can do it all: Emacs. In this post, I’ll outline how to get started with emacs. There are plenty of tutorials out there, but I’d say that the best way to learn is just to jump in. Thus, I will not spend a whole lot of time describing what M-x does (the answer is everything).