R Under development (unstable) (2024-02-17 r85935 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. > # This tests part of a problem as of zoo 1.7-11 that is fixed in the devel version. > #changeTSrepresentation() seems sometimes to need require("zoo") rather than > # requireNamespace("zoo"). zoo needs to overwrite the as.Date() generic since there > # is no default for the origin in the as.Date.numeric() method. > > #test2 <- function(){ > # loadNamespace("zoo") > # z0 <- ts(matrix(rnorm(10),10,1), start=c(1990,1), frequency=1) > # z1 <- zoo::as.Date(stats::time(z0)) > # as.ts(z1) > # } > > require("tframePlus") Loading required package: tframePlus Loading required package: tframe > > z0 <- ts(matrix(rnorm(10),10,1), start=c(1990,1), frequency=1) > > z <- changeTSrepresentation(z0, "zoo") Loading required namespace: zoo > > z <- changeTSrepresentation(z0, "ts") > > z Time Series: Start = 1990 End = 1999 Frequency = 1 Series 1 [1,] 0.7062685 [2,] -0.1659563 [3,] 0.2903426 [4,] 0.5158768 [5,] 0.4557828 [6,] 0.3151401 [7,] 0.6083810 [8,] -1.1295159 [9,] 0.2559918 [10,] -0.4828497 > > # this began failing with "the condition has length > 1" in devel version of R-4.1.3, Feb 2021 > #if(start(z) != 1990 ) stop("zoo changeTSrepresentation test 1 failed.") > > if(frequency(z) != 1) stop("zoo changeTSrepresentation test 2 failed.") > > # this began failing with "the condition has length > 1" in devel version of R-4.1.3, Feb 2021 > #if( ! z == z0) stop("zoo changeTSrepresentation test 3 failed.") > > if(class(z) != "ts") stop("zoo changeTSrepresentation test4 failed.") > > > proc.time() user system elapsed 0.54 0.06 0.59