added `dir.exists` since it's not in R 3.1