ro warning=FALSE, comment=NA or

Publishing On Figshare from R

Before you can use rfigshare effectively, you will need to set up your authentication credentials by obtaining a set of API keys from FigShare.org. See our Getting Started with rfigshare tutorial for a step by step guide.

Now that you have created your credentials, we are ready to start posting content to FigShare using R.

Step 1: Create a new article

require(rfigshare)

An article on FigShare can be a figure, poster, dataset, paper, or other media, and can contain an arbitrary number of files or attachements. Each article has a unique ID number which we will use to interact with it. All articles have the essential scientific metadata including a title, at least one author, and a description or abstract. Categories can be selected from a fixed list, while articles can be assigned any tags. This can be done step by step using dedicated functions, or simultaneously using the special function fs_new_article. For example, the command

id <- fs_new_article(title="A Test of rfigshare", 
                     description="This is a test of the fs_new_aricle function and related methods", 
                     type="figure", 
                     authors=c("Karthik Ram", "Scott Chamberlain"), 
                     tags=c("ecology", "openscience"), 
                     categories="Ecology", 
                     links="http://ropensci.org", 
                     files="figure/rfigshare.png")

Creates a new article with the metadata given and returns the article id number, so we can make future modifications quickly.

Step 2: Examine and modify article

We can check out the details of our new article to confirm the successful creation:

fs_details(id)

Note that the submitter is automatically added as an author, though it will not hurt to specify them in the author list if you want anyway. Note also the extra metadata we get, such as filesize and article views. (And hopefully we'll format that output to a pretty-printing version soon).

If there is something we need to change, we can edit our article accordingly. The fs_update function to modifies the title, description, and type, while fs_add_tags, fs_add_categories, fs_add_authors etc, can add missing data. If we upload a new figure, it will overwrite this one.

fs_update(id, title="An awesome test of rfigshare")

Step 3: Sharing or deleting your article

Once we are ready to share this, we can release the article privately or publicly. We actually could have done this during our fs_new_article step by setting visibility="private".

fs_make_private(id)

If we need to remove this example file we can delete it

fs_delete(id)

Note that articles declared "public" cannot be deleted, and changes will appear as new versions of the same article. fs_details can help you view particular versions of public articles.



ropensci/rfigshare documentation built on May 18, 2022, 6:34 p.m.