Assignment 7 - Loading the Data

Assignment 7 - Loading the Data

by Lauren Fleshner -
Number of replies: 3

Hello,

It was mentioned in class today to both not hard code the file name and to not load the data every time we need it. 

I am kind of confused as to how we're supposed to put the loading of the data file into a function, but then not need to load it again throughout the whole R script? How else would the next function know which data to load? I feel like I may have misunderstood something. 

Also, by not hard coding the file name, does that mean we're supposed to code the relative path to get to the file?

Any help would be appreciated. Thanks!

- Lauren Fleshner

In reply to Lauren Fleshner

Re: Assignment 7 - Loading the Data

by Erik Spence -
Why does the next function need to load the data? It only should be loaded once, in the driver script.

You can hard-code the file in the driver script, but not in the data-loading function.
In reply to Erik Spence

Re: Assignment 7 - Loading the Data

by Carly Davenport -
So we should be passing the arguments 1, 2, or 3 from the command line/bash to the driver script, and then in our driver scripts, we can call our functions and pass the day.csv file through their arguments?
If this is correct, I don't know how to put the file path or something to help find it so that it works when I test it in bash...
In reply to Carly Davenport

Re: Assignment 7 - Loading the Data

by Erik Spence -
I don't understand. You pass the filename into the data-loading function. The resulting data is then passed into each function that needs it. In this way the data is only loaded once per run of the driver script.