Importing Github R Code Directly From Code Page

Step 1

First select the run the following functional code, which will bring github code directly to the working file of the code

github_source=function(url){
  if (!require(pacman)) install.packages("pacman")
  pacman::p_load(base)
  return(source(paste0(url)))
}

Step 2

Then go to the Github code that you are intending to import. Then click on the “Raw” to get it in html format

Then you will find screen shown below.

Step 3

Now copy the link and paste in the code.

Note: Put the link between double quotation marks.

github_source("https://raw.githubusercontent.com/silumuduli/Time-Series-Models/main/Lag%20and%20Difference.R")