R Under development (unstable) (2025-01-09 r87552 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > library(nanotime) > suppressMessages(library(zoo)) > > set.seed(42) > x <- 100 + cumsum(rnorm(10)) > y <- 100 + cumsum(rnorm(10)) > mat <- cbind(x, y) > > now <- Sys.Date() > z <- zoo(mat, now + 0:9) > z x y 2025-01-11 101.3710 101.30487 2025-01-12 100.8063 103.59152 2025-01-13 101.1694 102.20265 2025-01-14 101.8023 101.92387 2025-01-15 102.2065 101.79054 2025-01-16 102.1004 102.42649 2025-01-17 103.6119 102.14224 2025-01-18 103.5173 99.48579 2025-01-19 105.5357 97.04532 2025-01-20 105.4730 98.36543 > > now <- Sys.time() > z <- zoo(mat, now + 0:9) > z x y 2025-01-11 00:22:00 101.3710 101.30487 2025-01-11 00:22:01 100.8063 103.59152 2025-01-11 00:22:02 101.1694 102.20265 2025-01-11 00:22:03 101.8023 101.92387 2025-01-11 00:22:04 102.2065 101.79054 2025-01-11 00:22:05 102.1004 102.42649 2025-01-11 00:22:06 103.6119 102.14224 2025-01-11 00:22:07 103.5173 99.48579 2025-01-11 00:22:08 105.5357 97.04532 2025-01-11 00:22:09 105.4730 98.36543 > > now <- nanotime(Sys.time()) > z <- zoo(mat, now + 11*(0:9)) # inc. by 11 to more visible, 1 works too > z x y 2025-01-10T23:22:00.163132906+00:00 101.3710 101.30487 2025-01-10T23:22:00.163132917+00:00 100.8063 103.59152 2025-01-10T23:22:00.163132928+00:00 101.1694 102.20265 2025-01-10T23:22:00.163132939+00:00 101.8023 101.92387 2025-01-10T23:22:00.163132950+00:00 102.2065 101.79054 2025-01-10T23:22:00.163132961+00:00 102.1004 102.42649 2025-01-10T23:22:00.163132972+00:00 103.6119 102.14224 2025-01-10T23:22:00.163132983+00:00 103.5173 99.48579 2025-01-10T23:22:00.163132994+00:00 105.5357 97.04532 2025-01-10T23:22:00.163133005+00:00 105.4730 98.36543 > > > proc.time() user system elapsed 0.65 0.04 0.70