ABSTRACT

This chapter deals with tapping into operating-system functions like listing files in a directory, adding one table to the bottom of another, manipulating data in lists, importing all CSV files in a directory at once, and changing working directories and then easily getting back to a user's project’s main working directory. In R, adding new rows to the bottom of an existing data frame is usually done by binding rows. If the user had multiple columns to be added to an existing data frame, then the user could bind columns. The base R functions for this are rbind() (for binding rows) and cbind (for binding columns). dplyr’s versions are bind_rows() and bind_cols(), and the end result is a data frame. purrr has a family of map functions that apply a function to each item in a vector or list. The user can specify the class of data he/she would like to be returned based on the function name.