[adegenet-commits] r336 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 28 17:10:06 CEST 2009


Author: jombart
Date: 2009-05-28 17:10:06 +0200 (Thu, 28 May 2009)
New Revision: 336

Modified:
   pkg/R/seqTrack.R
Log:
Fixed some issues in time conversion. 


Modified: pkg/R/seqTrack.R
===================================================================
--- pkg/R/seqTrack.R	2009-05-28 14:56:01 UTC (rev 335)
+++ pkg/R/seqTrack.R	2009-05-28 15:10:06 UTC (rev 336)
@@ -34,6 +34,8 @@
     N <- length(seq.names)
     id <- 1:N
 
+    seq.dates <- as.POSIXct(round.POSIXt(seq.dates,units="days")) # round dates to the day
+
     W <- as.matrix(W)
     ## rename dimensions using id
     colnames(W) <- rownames(W) <- id
@@ -302,7 +304,7 @@
     rangeSize <-  as.integer(difftime(dateMax,dateMin, units="days"))
     nbDays <- round(runif(n, min=0, max=rangeSize))
     res <- dateMin + nbDays*3600*24
-    res <- round(res, units="days")
+    res <- as.POSIXct(round(res, units="days"))
     return(res)
 }
 
@@ -401,6 +403,8 @@
     N <- length(seq.names)
     id <- 1:N
 
+    seq.dates <- as.POSIXct(round.POSIXt(seq.dates,units="days")) # round dates to the day
+
     W <- as.matrix(W)
 
     if(!is.null(proxMat) && !identical(dim(proxMat),dim(W))) {



More information about the adegenet-commits mailing list