The process for updating an existing public repository with new versions of existing files requires multiple steps:
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.
Obtain the article_id of the deposit, this is the numeric component of the DOI after figshare e.g. https://doi.org/10.6084/m9.figshare.3761562
library(rfigshare)
<- 3761562
article_id <- fs_details(article_id)
deposit_details $title deposit_details
Several files in this deposit are updated nightly, for instance:
"OLIdata_YYYY-MM-DD.txt"
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
.
library(dplyr)
<- unlist(deposit_details$files)
deposit_files <- data.frame(split(deposit_files, names(deposit_files)),stringsAsFactors = F)
deposit_files <- deposit_files %>%
file_id filter(grepl("^OLIdata_", name)) %>%
select(id) %>%
1]] .[[
Prepare the article for the new version of the file, by deleting the
existant version with fs_delete
fs_delete(article_id, file_id)
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())))
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:
fs_make_public(article_id)