Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexecutable code in chapter 1 #6

Open
capissimo opened this issue Nov 7, 2017 · 2 comments
Open

unexecutable code in chapter 1 #6

capissimo opened this issue Nov 7, 2017 · 2 comments

Comments

@capissimo
Copy link

capissimo commented Nov 7, 2017

No description provided.

@cedavil
Copy link

cedavil commented Jun 18, 2018

Has anyone had issues running the code on page 31?
I keep getting the following error message.
Error in x[j] : invalid subscript type 'list'

@michaelverano
Copy link

I'm getting a different issue with the code on this page.

Running sp500_sym[sp500_sym$sector=="etf", 'symbol'] yields the etfs you find on page 32 when running corrplot in the book. HOWEVER, running

etfs <- sp500_spx[row.names(sp500_px)>"2012-07-01", sp500_sym[sp500_sym$sector=="etf", 'symbol]] yields a different set of etfs.

i.e.
> sp500_sym[sp500_sym$sector=="etf", 'symbol']
> [1] XLI QQQ SPY DIA GLD VXX USO IWM XLE XLY XLU XLB XTL XLV XLP XLF XLK

but

> colnames(etfs)
[1] "VAR" "PBCT" "CINF" "ALLE" "JCI" "ENDP" "THC" "IPG" "SYK" "MCK" [11] "CERN" "STJ" "BXLT" "ESRX" "CAH" "TMO" "ZBH"

I admit that I am still learning R, so could it be something in the code? The data I used were the csv files from this github page and read with read.csv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants