Reputation: 2044
I'm looking to make my code available to others to run, and they need the correct csv files to run my code.
Once they have git cloned my repo, they need to get the data
so I currently have:
u = 'https://someURL/data/RegularSeasonCompactResults.csv'
download.file(u,'RegularSeasonCompactResults.csv')
data = read.table('RegularSeasonCompactResults.csv')
However, if the user runs this the second time, it will re-download the file, even though that is not necessary.
This seems like it could be a reoccurring problem for people, so im wondering if there is a built in solution to this?
Upvotes: 2
Views: 120
Reputation: 3728
Wrap it with if(!file.exists("RegularSeasonCompactResults.csv")){ ... }
Upvotes: 5