#clear the environment 
rm(list=ls()) 

#just in case 
#Iconify the help window and move on to the next part.
help.start()

#Check the working directory before importing else provide full path
#setwd(path)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))

##PACKAGES 

# # Run to see the total number of current packages available to users
length(available.packages()[,1])
#List of R core packages
row.names(installed.packages(priority="base"))

## #Opens a webpage when called from R or shows help in the help window in RStudio
help(install.packages)

##installing a specific package 
install.packages("fPortfolio")
library("fPortfolio")
help(package="fPortfolio")


## a smarter way of installing packages 


listofpackages <- c("shiny", "ggplot2", "hexbin", "dplyr", "httr", "jsonlite")

for (j in listofpackages){
  if(sum(installed.packages()[, 1] == j) == 0) {
    install.packages(j)
  }
  library(j, character.only = T)
}


library(shiny)
runGitHub("Yahoo_Finance","simaan84") 

