0

I have a large dataframe (6,300 columns * 5,480 rows) of daily prices of stocks. The data frame looks like this:

enter image description here

All the columns are marked numeric in the data frame (except the first one "Date", this is unknown). When I transform the data frame into an xts object, it changes the Date-column into the row names (which is good). And it also changes all my numeric columns into character columns (NOT GOOD).

I used the following code for the transformation:

XTS.PRICES <- xts(Prices[,-1], order.by=as.Date(Prices$Date)) 
Li4991
  • 59
  • 5
  • Check if all your columns are actually numeric. Probably one (or more) is a character. Most likely one that is filled with a lot of NA values in the beginning when you loaded the data. – phiver Jan 25 '23 at 09:13

0 Answers0