The process for updating an existing public repository with new versions of existing files requires multiple steps:

  1. Delete existing copies of files
  2. Upload new copies of the files
  3. Make your changes public

Note that the example below is for a specific repository, as you are not the author of the article you will not be able to run the code without errors.

Delete existing copies of files

Obtain the article_id of the deposit, this is the numeric component of the DOI after figshare e.g.

article_id <- 3761562
deposit_details <- fs_details(article_id)

Several files in this deposit are updated nightly, for instance:


To delete this file, the file_id must be found. It is simplest to convert the lists to a data_frame such that they may be operated on with dplyr.

deposit_files <- unlist(deposit_details$files)
deposit_files <- data.frame(split(deposit_files, names(deposit_files)),stringsAsFactors = F)
file_id <- deposit_files %>%
  filter(grepl("^OLIdata_", name)) %>%
  select(id) %>%

Prepare the article for the new version of the file, by deleting the existant version with fs_delete

fs_delete(article_id, file_id)

Upload new version of the file

The new file can be downloaded as follows:

# This file does not exist in these training materials.
fs_upload(article_id, paste0("OLIdata_", as.Date(Sys.time())))

Make changes public

The actions you have performed have been saved as draft changes, you must use fs_make_public to update the article and create a new version: