As the title suggests, I keep getting back an error message when trying to create a string of characters in R.
Here is some background into my problem.
I am working on a project where I'll be modifying and testing the Markowitz portfolio selection method by using the 503 stocks currently listed as a part of the S&P 500. I've sourced all 503 tickers with their daily Open,Close, Adjusted, High, Low, and Volume data with quantmod and merged them into an xts object called Full.
tickers = c("AAPL", "MSFT", "AMZN",...)
quantmod(getSymbols(tickers, src = 'yahoo', from = Sys.Date()-(20*365))
Full = merge(SPY,AAPL, MSFT, AMZN, ...)
Now I want to remove the High, Low, and Volume data from this xts object by creating a subset. Ideally, the code should look something like this.
subset1 = c("SPY.High","SPY.Low","SPY.Volume",...)
Full.OCAV = subset(FULL, select = !subset1)
However, the first line of this code either spits back an unexpected symbol error or prompts me to close the code by placing me in o + line on the console (this happens even when I do not edit the code).
I guess it is possible that there is a typo in the string, however there are two reasons I am so confident there is not. Firstly, I created the list of string characters in excel with the concatenate function, so I know the syntax of each element is identical. I did the same thing to create the 'tickers' vector which worked without any issues. Second, subset1=... works if I remove some of the character elements. I even removed all but the last 20 elements and got it to work, so I checked the last 20 elements for typos and there are none.
I guess I could create two subsets and merge them, but I'd like to have this be tractable because I'll need to perform other mass operations on the dataset going forward and I don't want to have to create many small subsets each time.
Is this an issue of the size of the string? There are 503*3 elements and I am running R on my laptop.