This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(ggplot2)
library(xts)
## Warning: package 'xts' was built under R version 3.3.1
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 3.3.1
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(dygraphs)
## Warning: package 'dygraphs' was built under R version 3.3.1
nasdaq_url <- "http://chart.finance.yahoo.com/table.csv?s=^IXIC&a=6&b=31&c=2014&d=6&e=31&f=2016&g=d&ignore=.csv"
yahoo.read<- function(url){
dat <- read.table(url, header=TRUE, sep = ",")
df <- dat[,c(1,5)]
df$Date <- as.Date(as.character(df$Date))
return (df)
}
nasdaq <- yahoo.read(nasdaq_url)
You can also embed plots, for example:
Note on how I plot.