Skip to content

Instantly share code, notes, and snippets.

@StefanThoma
Last active July 6, 2021 12:20
Show Gist options
  • Save StefanThoma/019bda58a6cefe7cc80e7f9877432a3b to your computer and use it in GitHub Desktop.
Save StefanThoma/019bda58a6cefe7cc80e7f9877432a3b to your computer and use it in GitHub Desktop.
Check if File exists. If not, create it and save.
filename <- paste("file", ".csv", sep = "")
if(filename %in% list.files()){
# Load files
df <- read_csv(filename)
} else{
# create df
# save df
write_csv(df, filename)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment