Skip to main content

Posts

Showing posts from March, 2016

Shiny programming: Date range select for stock plot using Quandl and Shiny

This experiment will plot the Microsoft stock or the Google stock depending on user input. User can also select a date range. The Shiny application will be called Experiment2. To set things up I will need to create 4 things 1. Create an Experiment2 folder. 2. Create a server.R script file in the Experiment2 folder. 3. Create a ui.R script file in the Experiment2 folder. 4. Create an Experiment2_App.R script file outside the Experiment1 folder. The server.R script is library(shiny) library(Quandl) library(ggplot2) shinyServer(function(input, output) {     # Place this variable here. It will be run only once each time a user visits the app.   # This makes the output unique to a particular user   stkList <- data.frame(name=c("Microsoft", "Google"),symbol=c("GOOG/NASDAQ_MSFT","GOOG/NASDAQ_GOOGL" ),stringsAsFactors = FALSE)     output$text1 <- renderText({     paste("You have selected ",input$var)   }) ...

Shiny programming: Google stock for 2015 using Quandl and Shiny

"Shiny" is a nice tool for data analysis and visualisation available for download ín R. You can create interactive webpages and use supporting packages like "highcharter" to make the plotting more interactive by directly manipulating the plot to change the input and reflect the changed input to your outputs. These notes are an ongoing series of experiments in my learning of the package. Lets plot the time series of Google stock. The data for Google is downloaded using Quandl. Every Quandl code has 2 parts: the database code which specifies where the data comes from, and the dataset code which identifies the specific time series you want. To browse you can use https://www.quandl.com/browse . You need an api key for this which you can easily get using your linkedin login or google login. For example here is what a request would look like for downloading Google stock data for the year 2015. library("Quandl") stkPrice_Google2015 <- Quandl(...