Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Rcode1
#R version 3.3.2 print("===== Download DJIA and 30 compound stocks =====") download_data = function(url) { raw = read.table(url, header=TRUE, sep=",") raw = raw[, c(1, 7)] # 1 is Date column, 7 is Adj.Close column raw = raw[nrow(raw):1, ] # Sort oldest to newest return(raw) } djia_url = "http://chart.finance.yahoo.com/table.csv?s=^DJI&a=7&b=30&c=2013&d=7&e=30&f=2016&g=m&ignore=.csv" compounds = c("CVX", "INTC", "MMM", "DIS", "GE", "V", "TRV", "DD", "WMT", "IBM", "XOM", "AXP", "HD", "MCD", "CSCO", "MRK", "JPM", "PFE", "JNJ", "UTX", "UNH", "PG", "KO", "CAT", "MSFT", "GS", "AAPL", "NKE", "VZ", "BA")
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
10=08-2020Newton
此次次
Basic Programming
Are the items of a vector in a given data frame? (Filtering basics)
Regra-trapezio
AjusteNaoLinear11-02-21
Ch. 5: Cookie Chip Sampling - Idealized
Mandelbrotset
First wall
Multiple linear regression modals
Please log in to post a comment.