Sharing software code produced during a research project has become standard procedure in many fields. In addition, publishers and funding agencies may require you to share your code as a provision for article publication or as part of your research grant.
The Stanford Digital Repository (SDR) is an excellent option for sharing software code. The SDR is a Stanford University Libraries service that allows you to upload your files along with descriptive information into our preservation system. Your content will be assigned a persistent identifier, much like a DOI, and will be available at a persistent URL, or PURL. By doing this you will be making your content easily discoverable and citable by other researchers. You will also be fulfilling funding agency and publisher requirements for making code from your research available. Your content will be included in the Library catalog, which is crawled by Google, making your results available through a Google search.

While you may be storing your code in a public repository like GitHub, the SDR is an excellent complement to that practice, because it allows you to preserve and share the exact version of the content used for a specific publication and to create reciprocal links between the publication and that version of the code.
In addition, you can power visualizations directly in R directly from data stored in the SDR. Check out an example in this blog post!
Below are some examples of R code that have been preserved in the Stanford Digital Repository.