1

I currently have an xts with a character string column called "Symbol" and then several columns of numerical and character data. The data is mostly weekly and also at the end of the month. I would like to aggregate this data to a monthly periodicity for each of the "Symbols" present in the data, so in other words I want to get the monthly data for each symbol, not just for a random symbol which is chosen by quantmod. I tried using

to.period(df.xts, 'years', OHLC = FALSE)

from quantmod but ran into the problem that only one row was being chosen for each month.

vrajs5
  • 4,066
  • 1
  • 27
  • 44
user2844947
  • 75
  • 1
  • 9
  • Where is the test data? Post sample data.. – vrajs5 Jun 10 '14 at 11:45
  • Its just an xts that has a column with a string ticker/symbol like "AAPL" or "IBM" and then several other columns of data such as prices and other financial metrics. – user2844947 Jun 10 '14 at 11:50
  • 2
    You can't mix numeric and character data in the same xts object. You should create a separate xts for each symbol – GSee Jun 10 '14 at 11:50
  • Okay. How would I do that? Or just assume that everything is character data. I can convert back to numeric later. I would prefer the second option if possible since I have around 300 tickers. – user2844947 Jun 10 '14 at 11:51

0 Answers0