Joining Project Data

Author

Gabriel I. Cook

Published

February 6, 2024

Under construction.

This page is a work in progress and may contain areas that need more detail or that required syntactical, grammatical, and typographical changes. If you find some part requiring some editing, please let me know so I can fix it for you.

Overview

In this module, we will address several concepts related to reading and writing data files. For example, we will address filename extensions and file formats, file paths associated with where files are stored, reading files that are saved in common file formats, writing files to preserve data types, and libraries associated with handling these issues.

To assist with file paths, we will use the {here} library to help manage files stored locally (on your computer) as part of an RStudio project. You will also learn how to read and write data files of different formats. Depending how you access data, the process of reading data may change so this topic is discussed in a general way with different approaches described. If you find yourself in a bind with reading data, one of these approaches will likely work. We will cover functions for reading and writing data from Base R, as well as {dplyr}, {rio}, and {haven} libraries.

To Do

Supplementary Readings

Task

Libraries

  • {here} 1.0.1: for file path management
  • {readr} 2.1.4: for reading .csv, .tsv, and .fwf files
  • {openxlsx} 4.2.5.2: for reading Excel spreadsheets from a URL and writing Excel files
  • {haven} 2.5.4: for reading SPSS, Stata, and SAS files (e.g., .sav, .dta, .sas7bdat, etc. )
  • {rio} 1.0.1: a Swiss-Army knife for data I/O

Related:

  • {readxl} 1.4.3: for reading Excel spreadsheets