Hi John,

John Kane wrote:
help("%in%") may be of use. However I don't see any overlap in your example.
You are right! I've choosen an example where the intersection is 0. But we 
could consider this other case...

endPeriod<-as.POSIXlt("2008-09-30")
startPeriod<-as.POSIXlt("2007-10-01")
endProject<-as.POSIXlt("2007-12-31")
startProject<-as.POSIXlt("2006-12-01")

project <- as.numeric(endProject-startProject)
period <- as.numeric(endPeriod-startPeriod)

I see how to use intersect with numbers as in the example:

intersect(1:10,7:20)

%in% returns a logical vector indicating if there is a match or not, thus it is 
not an option for us.

*Please, how could I pass the date in seconds to intersect?*

I know how to  get system time in seconds, unclass(Sys.time()), but how could I 
get endPeriod, startPeriod and so on, so forth, to pass this values to 
intersect? It is the only way I can figure out to get a vector with the 
intersecting period. It will be a huge vector in some cases, but I guess I 
could get its size in anyway and to avoid to print out the values.

Thanks for your help,

Ricardo


--
Ricardo Rodríguez
Your XEN ICT Team

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to