Read File Based on Extension
read_file.RdThis function reads a file based on its extension and returns the data in a suitable format. It supports reading text files, CSV files, Stata files, Excel files, and SAS files.
Details
The function uses different packages to read different file types:
data.table::freadfor reading text and CSV files.readstata13::read.dta13for reading Stata files.readxl::read_xlsxfor reading Excel files.haven::read_sasfor reading SAS files.