Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# change column names to R-friendly format
colnames(gbppln)[colnames(gbppln)=="High (est)"] <- "High_est"
colnames(gbppln)[colnames(gbppln)=="Low (est)"] <- "Low_est"
# change column names to R-friendly format
colnames(gbppln_xts)[colnames(gbppln_xts)=="High (est)"] <- "High_est"
colnames(gbppln_xts)[colnames(gbppln_xts)=="Low (est)"] <- "Low_est"
# remove the high/low estimates columns
gbppln_xts$High_est <- NULL
gbppln_xts$Low_est <- NULL
# add date info (lubridate package)
gbppln$Year <- year(gbppln$Date)
gbppln$Month <- month(gbppln$Date)
gbppln$Day <- day(gbppln$Date)
# add volatility
gbppln$Volatility <- gbppln$High_est-gbppln$Low_est
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment