6.4 Saving the Processed Data
Finally, we save the cleaned data frame to a CSV file so it can be loaded directly in later chapters without repeating the cleaning steps:
The write.csv() function writes the data frame to a CSV file. The row.names = FALSE argument prevents R from adding an extra column of row numbers, which would clutter the output file.
Column Names in the Saved File
Because we used read_delim() to load the original data, the column names in our saved CSV contain spaces (e.g., Absenteeism time in hours, Social smoker). When we load this file in later chapters, we will continue to use backticks to reference these columns. This is consistent with the approach used throughout the book.