Writing modular code in RStudio