0

I have two time series of the same length of class zoo. One of them as NA value for some dates while the other one is completely filled by value. Since I need to plot some pie charts, I would need to disregard the dates with NA values also in the other time series.

This is what I did:

  ind.pos <- which(is.na(a1[,1]) == 'TRUE')

  for (i in ind.pos  ) {
  b1[[i]] <- NA
}

Which is working fine. I was just wondering if there is a more efficient way to accomplish that.

Thanks

1 Answers1

1

Not sure if I missed some point, but wouldn' this work:

b1[is.na(a1)]<-NA 

Here your time series are a1 and b1 and a1 contains NA's.

Jouni Helske
  • 6,427
  • 29
  • 52