How to Upload Files to Github Using R
How to upload your R code on GitHub: example with an R script on MacOS
- Introduction
- Prerequisite
- Stride-by-step guide
- Boosted notes
Introduction
Few days agone, a colleague asked me how to upload some R code on GitHub in order to make it accessible to everyone. Due to the lockdown, I could non just become into his function and show him on his computer. And then I sent him several screenshots showing, step past step, how to exercise so.
Right earlier I deleted the screenshots I'd but taken, I idea that perhaps they would be useful for other persons, so I wrote this commodity.
Note 1: The screenshots have been taken on MacOS and I have not tested it on Windows. Do not hesitate to let me know in the comments whether it is like or not on other operating systems.
Notation 2: There must exist other means to do it, but the method shown below is (in my opinion) easy and works well.
Prerequisite
In order to follow this guide and upload your R lawmaking on GitHub, you will need at to the lowest degree:
- a GitHub account
- the GitHub Desktop application installed on your computer
Step-past-step guide
For this guide, I use a R script created to plot the evolution of the hospital admissions due to COVID-19 in Belgium. Meet the repository on GitHub in case you want to run into the concluding event before proceeding further.
You ofttimes hear
"A film is worth a k words"
So hither is without further ado how to upload your R script on GitHub in images:
Be careful that if you choose to brand it public, it volition be visible to everyone. If you do not want to share the code, but still want information technology to be uploaded on GitHub, cull the private option.
Initializing the repo with a README file is not mandatory, just I strongly recommend it so you lot will be able to add information for this repo.
(See how to install R and RStudio if you are unfamiliar with it.)
Yous tin meet the path to the folder in step six c, under "Local Path".
In stride 10, make certain that the current repository (see top left) is the repo you are currently working on.
Your R code is now available online via the new repository on your GitHub profile. If you demand to share it, you can simply share the URL of the repo.
Boosted notes
If you lot need to edit your code:
- Find the folder of the repo on your figurer by clicking on the button "Show in Finder":
- Y'all will be redirect to the binder of your repo on your estimator. Open the R script y'all want to piece of work on, edit it and save information technology:
- Afterward your script is saved, do not forget to commit the changes and push button the commit (see step ten above).
In case you need to meet an old version of your code, you can see all commits by clicking on the commits tab accessible via the repo on github.com:
Thanks for reading. I hope this commodity helped y'all to create a GitHub repository, and upload your R scripts so that it is bachelor to anyone.
As ever, if yous have a question or a suggestion related to the topic covered in this article, please add it as a annotate then other readers can benefit from the word.
Liked this post?
Become updates every time a new article is published.
No spam and unsubscribe someday.
Share on:
letsonripplexprem.blogspot.com
Source: https://statsandr.com/blog/how-to-upload-r-code-on-github-example-with-an-r-script-on-mac-os/
0 Response to "How to Upload Files to Github Using R"
Post a Comment