I\'ve created a R markdown file that starts by loading a file from the web. I found the cache=TRUE to be a little flaky so I want to put an if condition in to check for the
You can use tryCatch
tryCatch
if(!file.exists(destfile)){ res <- tryCatch(download.file(fileURL, destfile="./data/samsungData.rda", method="auto"), error=function(e) 1) if(dat!=1) load("./data/samsungData.rda") }