Re: [R] Dates in Common

2009-01-23 Thread r...@quantide.com
The problem is in the intersect function that does x = as.vector(x) and therefore transforms date vector into a numeric . Try to: d1 = as.character(data1) ; d2 = as.character(data2) d = intersect(d1, d2) data = as.Date(d) A. Tom La Bone wrote: I have two collections of dates and I want to fig

Re: [R] Dates in Common

2009-01-23 Thread Whit Armstrong
you want: ans <- intersect(data1,data2) class(ans) <- c("POSIXt","POSIXct") I personally think intersect should preserve the class of the object (if both args have the same class), but I think r-core has a different opinion. -Whit On Fri, Jan 23, 2009 at 9:02 AM, Tom La Bone wrote: > > I have