What is considered best practice when importing data in a 'pipeline'?

Let's say I have some sort of process that takes data from a CSV that is located on my local machine. This process will eventually need to be scheduled via some cron job. I need to import that data obviously and if I'm writing an automated script there are two main solutions for this.

Create a user defined function that includes the import statement in the body.

    import_data_and_clean <- function(full_path){

data = read_csv(path)