Refactored R data loading functionality into a separate module for reuse across the project.