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)

Create a dataset_builder.R file that not only imports the data, but also cleans and prepared the data for analysis.

data = read_csv(path)

My question pertains to which of these solutions was the reccomended way to do this in R?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.