Skip to content

Merging 2 files with different timestamp

1 message · Jeff Newmiller

#
You have by now seen some other responses on the list. Keeping the list 
included will insure you continue to get mulitple eyes looking at the 
problem and will benefit others trying to use the answers.

Two comments:

1) Your first format includes a specification for seconds. If that is 
nonzero at any point you could have difficulty aligning that data with the 
second format. In some cases this may be desirable, in other cases you may 
prefer to use some kind of "nearest minute" calculation such as 
trunc.POSIXt or round.POSIXt might yield. If you do so, be aware that 
those functions always return POSIXlt, and efficient computation is 
usually obtained with POSIXct, so convert if you have to.

2) It is not necessary to convert back to character as Jim Holtman 
suggests in order to merge the data... working with POSIXct data type 
directly will be more efficient. I would warn against using POSIXlt for 
merging, though, for poor efficiency reasons.
On Mon, 23 May 2016, Bhaskar Mitra wrote:

            
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                       Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
---------------------------------------------------------------------------