Skip to content

Instantly share code, notes, and snippets.

@neerajnagi
Created February 20, 2017 08:32
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 neerajnagi/894ffea79195439ea63eedc9abbdfe03 to your computer and use it in GitHub Desktop.
Save neerajnagi/894ffea79195439ea63eedc9abbdfe03 to your computer and use it in GitHub Desktop.
safe saveRDS
saveRDSCustom <- function(obj,fileName){
  tryCatch({
    fileConn<-file(fileName,blocking = TRUE)
    saveRDS(obj,fileConn)
    close(fileConn)
    return(TRUE)
  }
  ,error=function(e){
  cat(e)
  return(FALSE) }
  )  
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment