Skip to content

Instantly share code, notes, and snippets.

@viniroger
Created April 22, 2019 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viniroger/437139d2a2531d454e906a40a8c0e7d3 to your computer and use it in GitHub Desktop.
Save viniroger/437139d2a2531d454e906a40a8c0e7d3 to your computer and use it in GitHub Desktop.
Try catch read CSV file with error function and warning print
diretorio = '/home/user/model'
uid = 1
filename = sprintf('%s/saida/saida_%s/prevaz_%s.csv', diretorio, 'semanal', uid)
values = tryCatch(read.csv(filename,as.is = TRUE),
error = function(e) NA, warning = function(w) print('Without semanal file'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment