0

I am working with an imported csv file y<- read.csv("y.csv",header=T,sep=",")

and I get this error:

Error in merge.xts(..., all = all, fill = fill, suffixes = suffixes): 'NA' not allowed in 'index' 

However I do not have any NA in the data. I have tried y <- na.omit(y)

but I still get the same error.

I would be grateful for your help.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
adam.888
  • 7,686
  • 17
  • 70
  • 105
  • Please post more of your code (as Joshua points out, that line of code cannot give that error message), and if you can the first and last few lines of y.csv. – Darren Cook Mar 12 '12 at 00:22

1 Answers1

1

read.csv returns a data.frame, not an xts object. You don't tell us how you create the xts object you're trying to merge. I suspect something is going wrong when you create the xts object.

Also, na.omit will only remove missing values in the coredata of the xts/zoo object. The index is a separate attribute. Therefore, missing values in the index will only be dropped if they have a corresponding missing value in the coredata.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418