Return to Course Material

Sample R Code for FiRM

#for loops – read.csv read.table etc
#source a file t.test rnorm, etc.
#glm
#get.hist.quote
wdir=”D:\\Rnw to Latex for FiRM\\”
setwd(wdir) #this sets the working directory to my flashdrive

for (u in 1:10){print(u)}

if (!require(BatchGetSymbols)) install.packages(‘BatchGetSymbols’)
if(!require(psych)){install.packages(“psych”)}
if(!require(DescTools)){install.packages(“DescTools”)}
if(!require(Rmisc)){install.packages(“Rmisc”)}
if(!require(FSA)){install.packages(“FSA”)}
if(!require(plyr)){install.packages(“plyr”)}
if(!require(boot)){install.packages(“boot”)}

library(BatchGetSymbols)
#library(quantmod)
#library(ggplot2)
#library(psych)