R Under development (unstable) (2024-06-18 r86781 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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 2024-06-19 101.3710 101.30487 2024-06-20 100.8063 103.59152 2024-06-21 101.1694 102.20265 2024-06-22 101.8023 101.92387 2024-06-23 102.2065 101.79054 2024-06-24 102.1004 102.42649 2024-06-25 103.6119 102.14224 2024-06-26 103.5173 99.48579 2024-06-27 105.5357 97.04532 2024-06-28 105.4730 98.36543 > > now <- Sys.time() > z <- zoo(mat, now + 0:9) > z x y 2024-06-19 13:40:11 101.3710 101.30487 2024-06-19 13:40:12 100.8063 103.59152 2024-06-19 13:40:13 101.1694 102.20265 2024-06-19 13:40:14 101.8023 101.92387 2024-06-19 13:40:15 102.2065 101.79054 2024-06-19 13:40:16 102.1004 102.42649 2024-06-19 13:40:17 103.6119 102.14224 2024-06-19 13:40:18 103.5173 99.48579 2024-06-19 13:40:19 105.5357 97.04532 2024-06-19 13:40:20 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 2024-06-19T11:40:11.258248091+00:00 101.3710 101.30487 2024-06-19T11:40:11.258248102+00:00 100.8063 103.59152 2024-06-19T11:40:11.258248113+00:00 101.1694 102.20265 2024-06-19T11:40:11.258248124+00:00 101.8023 101.92387 2024-06-19T11:40:11.258248135+00:00 102.2065 101.79054 2024-06-19T11:40:11.258248146+00:00 102.1004 102.42649 2024-06-19T11:40:11.258248157+00:00 103.6119 102.14224 2024-06-19T11:40:11.258248168+00:00 103.5173 99.48579 2024-06-19T11:40:11.258248179+00:00 105.5357 97.04532 2024-06-19T11:40:11.258248190+00:00 105.4730 98.36543 > > > proc.time() user system elapsed 1.07 0.20 1.73