Create a gist now

Instantly share code, notes, and snippets.

# Reuters-like colours
# https://s3.amazonaws.com/quandl-static-content/Documents/Quandl+-+R+Cheat+Sheet.pdf
fx.plot <- ggplot(data = gbppln, aes(x=Date,y=Rate)) +
geom_line(color = "#FAB521")+
theme(panel.background = element_rect(fill="#393939"),
panel.grid.major.x = element_blank(),
panel.grid.major.y = element_line(colour="white", size=0.1),
panel.grid.minor = element_line(colour="white", size=0.1)) +
xlab("Date") +
ylab("GBP/PLN") +
ggtitle("Exchange Rates")
# print the plot
fx.plot
# exchange rates by volatility
p <- ggplot(gbppln, aes(x=Date, y=Rate))
p + geom_line(aes(colour=Volatility)) +
ggtitle("GBP/PLN Exchange Rates")
# exchange rates - density plot - year
qplot(Rate, data = gbppln, geom = "density", fill = as.factor(Year)) +
ggtitle("GBP/PLN Exchange Rates")
# exchange rates - density plot - month
qplot(Rate, data = gbppln, geom = "density", fill = as.factor(Month)) +
ggtitle("GBP/PLN Exchange Rates")
# exchange rates - histogram - year
qplot(Rate, data = gbppln, geom = "histogram", fill = as.factor(Year)) +
ggtitle("GBP/PLN Exchange Rates")
# exchange rates - histogram - month
qplot(Rate, data = gbppln, geom = "histogram", fill = as.factor(Month)) +
ggtitle("GBP/PLN Exchange Rates")
# volatility - histogram
qplot(Volatility, data = gbppln, geom = "histogram", fill = as.factor(Month)) +
ggtitle("Volatility")
# check the missing values for volatility
qplot(Volatility>0, data = gbppln, geom = "histogram", fill = as.factor(Volatility>0)) +
ggtitle("Missing Volatility Values")
# exchange rates by year - box plots
p1 <- ggplot(gbppln, aes(as.factor(Year), Rate))
p1 + geom_boxplot(aes(fill = as.factor(Year))) +
ggtitle("GBP/PLN Exchange Rates")
# exchange rates by month - box plots
p2 <- ggplot(gbppln, aes(as.factor(Month), Rate))
p2 + geom_boxplot(aes(fill = as.factor(Month))) +
ggtitle("GBP/PLN Exchange Rates")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment