Open iTerm (OS X) to a Directory from R

Sometimes you need to get to a command prompt from R, whether it’s to wrangle git on the command line or do some package work. RStudio provides ways to do this from menus and hotkeys, but on OS X it sticks you in Terminal.app. I’m an iTerm user—and, I really prefer being in that app vs the one Apple ships—so, I wrote a tiny function that will drop you into either the current working directory or a path you specify.