How to Upload a Picture to Github File

How to upload your R code on GitHub: case with an R script on MacOS

  • Introduction
  • Prerequisite
  • Step-by-stride guide
  • Additional notes

Introduction

Few days ago, a colleague asked me how to upload some R code on GitHub in social club to make it accessible to everyone. Due to the lockdown, I could non simply go into his office and show him on his computer. So I sent him several screenshots showing, step by step, how to do so.

Right before I deleted the screenshots I'd simply taken, I thought that possibly they would be useful for other persons, so I wrote this article.

Notation 1: The screenshots have been taken on MacOS and I have non tested it on Windows. Do non hesitate to let me know in the comments whether it is like or not on other operating systems.

Annotation 2: In that location must be other ways to practise information technology, but the method shown below is (in my opinion) easy and works well.

Prerequisite

In lodge to follow this guide and upload your R code on GitHub, you volition need at least:

  • a GitHub business relationship
  • the GitHub Desktop application installed on your computer

Stride-by-step guide

For this guide, I utilise a R script created to plot the development of the infirmary admissions due to COVID-19 in Belgium. Meet the repository on GitHub in case you want to see the final result before proceeding further.

You oftentimes hear

"A picture is worth a thousand words"

And so here is without farther ado how to upload your R script on GitHub in images:

Stride 1: Go to github.com/login and sign in

Step 2: Go to your GitHub contour and create a new repository

Step 3: Set the name, description, audience and README file for the new repository

Be careful that if you choose to brand information technology public, information technology volition be visible to everyone. If you do not desire to share the lawmaking, simply withal desire it to be uploaded on GitHub, cull the individual option.

Initializing the repo with a README file is not mandatory, only I strongly recommend it so you lot will be able to add information for this repo.

Step 4: You at present see your new repository with only the README file

Stride v: Open the GitHub Desktop awarding and sign in with your GitHub account

Step 6 a: Clone the repository y'all only created on github.com to your computer

Footstep half-dozen b: Clone the repository you lot but created on github.com to your computer

Footstep 6 c: Clone the repository you just created on github.com to your computer

Step seven: Your new repo appears on the GitHub Desktop application

Step eight: Open an R script and write your code

(See how to install R and RStudio if you are unfamiliar with it.)

Step 9 a: Save your R script in the corresponding folder

You tin can see the path to the folder in pace vi c, under "Local Path".

Stride 9 b: Save your R script in the corresponding folder

Footstep 10: Reopen GitHub Desktop, edit the commit title (1) and click on the commit button (2)

In footstep 10, make sure that the current repository (see tiptop left) is the repo you are currently working on.

Step eleven: Push button the commit to github.com

Step 12: On your GitHub profile, click on the newly created repository

Footstep 13: You now see your script which has been added to the repository

Your R code is now available online via the new repository on your GitHub profile. If you need to share it, y'all tin simply share the URL of the repo.

Boosted notes

If you need to edit your lawmaking:

  1. Find the folder of the repo on your computer by clicking on the button "Show in Finder":

Discover the folder of your repo on your figurer

  1. You will exist redirect to the binder of your repo on your computer. Open the R script you desire to work on, edit it and relieve it:

Open the R script, edit it and salvage information technology

  1. After your script is saved, practice non forget to commit the changes and push the commit (meet step ten above).

In case you need to see an old version of your lawmaking, you can see all commits by clicking on the commits tab accessible via the repo on github.com:

See all commits

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 always, if you have a question or a suggestion related to the topic covered in this article, please add it equally a comment so other readers can benefit from the discussion.



Liked this post?

Get updates every fourth dimension a new article is published.
No spam and unsubscribe anytime.

Share on:

geerthrooked.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 a Picture to Github File"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel