From 24762f2d4abc47e5fcf40e2a22a538a143864e09 Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Wed, 12 Oct 2022 11:11:18 -0500 Subject: [PATCH] Remove 'fts' package (archived on 2022-05-09) --- DESCRIPTION | 2 +- NAMESPACE | 6 --- R/fts.R | 59 --------------------- R/xts.R | 2 +- R/zzz.R | 1 - inst/unitTests/runit.fts.R | 102 ------------------------------------- man/as.xts.Rd | 1 - man/as.xts.methods.Rd | 5 -- 8 files changed, 2 insertions(+), 176 deletions(-) delete mode 100644 R/fts.R delete mode 100644 inst/unitTests/runit.fts.R diff --git a/DESCRIPTION b/DESCRIPTION index 91da7700..97a37d00 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ Authors@R: c( Depends: zoo (>= 1.7-12) Imports: methods LinkingTo: zoo -Suggests: timeSeries, timeDate, tseries, chron, fts, tis, RUnit +Suggests: timeSeries, timeDate, tseries, chron, tis, RUnit LazyLoad: yes Description: Provide for uniform handling of R's different time-based data classes by extending zoo, maximizing native format information preservation and allowing for user level customization and extension, while simplifying cross-class interoperability. License: GPL (>= 2) diff --git a/NAMESPACE b/NAMESPACE index 733e2d5d..5386ad55 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -307,12 +307,6 @@ S3method(as.xts,timeSeries) # irts (package:tseries) specific methods S3method(as.xts,irts) -# fts (package:fts) specific methods -if (getRversion() >= "3.6.0") { - S3method(fts::as.fts, xts) -} -S3method(as.xts,fts) - # Date specific methods S3method(as.xts,Date) diff --git a/R/fts.R b/R/fts.R deleted file mode 100644 index 79dd3e76..00000000 --- a/R/fts.R +++ /dev/null @@ -1,59 +0,0 @@ -# -# xts: eXtensible time-series -# -# Copyright (C) 2008 Jeffrey A. Ryan jeff.a.ryan @ gmail.com -# -# Contributions from Joshua M. Ulrich -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -`as.xts.fts` <- -function(x, ..., .RECLASS=FALSE) -{ - dates <- .index(x) # fts uses POSIXct - attributes(dates) <- NULL - if(.RECLASS) { - .xts(unclass(x), dates, .CLASS="fts", ...) - } else { - .xts(unclass(x), dates, ...) - } -} - -`as.fts.xts` <- -function(x) -{ - if(!requireNamespace('fts', quietly=TRUE)) { - fts <- function(...) message("package 'fts' is required") - } else { - fts <- fts::fts - } - - ix <- .index(x) - attributes(ix) <- NULL - fts(ix, coredata(x)) -} - -re.fts <- function(x, ...) -{ - if(!requireNamespace('fts', quietly=TRUE)) { - fts <- function(...) message("package 'fts' is required") - } else { - fts <- fts::fts - } - - ix <- .index(x) - attributes(ix) <- NULL - fts(ix, coredata(x)) -} diff --git a/R/xts.R b/R/xts.R index ba6b9c91..1eae374d 100644 --- a/R/xts.R +++ b/R/xts.R @@ -23,7 +23,7 @@ # additional methods are in correspondingly named .R files # current conversions include: # timeSeries, its, irts, ts, matrix, data.frame, and zoo -# MISSING: fts, tis, fame +# MISSING: tis, fame # # this file includes the main xts constructor as well as the reclass # function. diff --git a/R/zzz.R b/R/zzz.R index 4f9b1a1e..4a684a6e 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -64,7 +64,6 @@ function(pkg, generic, class, fun = NULL) # } if (getRversion() < "3.6.0") { register_s3_method("timeSeries", "as.timeSeries", "xts") - register_s3_method("fts", "as.fts", "xts") if (utils::packageVersion("zoo") < "1.8.5") { # xts:::as.zoo.xts was copied to zoo:::as.zoo.xts in zoo 1.8-5 register_s3_method("zoo", "as.zoo", "xts") diff --git a/inst/unitTests/runit.fts.R b/inst/unitTests/runit.fts.R deleted file mode 100644 index a54ef67e..00000000 --- a/inst/unitTests/runit.fts.R +++ /dev/null @@ -1,102 +0,0 @@ -if (requireNamespace("fts", quietly = TRUE)) { - -data(sample_matrix) -sample.fts1 <- ts(sample_matrix,start=as.Date(rownames(sample_matrix)[1])) -sample.fts1 <- fts::fts(index(sample.fts1), sample_matrix) -sample.xts.fts1 <- as.xts(sample.fts1) - - -test.convert_fts_to_xts <- function() { - checkIdentical(sample.xts.fts1,as.xts(sample.fts1)) -} -test.convert_fts_to_xts_j1 <- function() { - checkIdentical(sample.xts.fts1[,1],as.xts(sample.fts1)[,1]) -} -test.convert_fts_to_xts_i1 <- function() { - checkIdentical(sample.xts.fts1[1,],as.xts(sample.fts1)[1,]) -} -test.convert_fts_to_xts_i1j1 <- function() { - checkIdentical(sample.xts.fts1[1,1],as.xts(sample.fts1)[1,1]) -} - - -test.fts_reclass <- function() { - checkIdentical(sample.fts1,reclass(try.xts(sample.fts1))) -} -test.fts_reclass_subset_reclass_j1 <- function() { - checkIdentical(sample.fts1[,1],reclass(try.xts(sample.fts1))[,1]) -} -test.fts_reclass_subset_as.xts_j1 <- function() { - checkIdentical(sample.fts1[,1],reclass(try.xts(sample.fts1)[,1])) -} -test.fts_reclass_subset_fts_j1 <- function() { - checkIdentical(sample.fts1[,1],reclass(try.xts(sample.fts1[,1]))) -} - -# quarterly series -sample.fts4 <- ts(sample_matrix,start=1960,frequency=4) -sample.fts4 <- fts::fts(index(sample.fts4), sample_matrix) -sample.xts.fts4 <- as.xts(sample.fts4) - - -test.convert_fts4_to_xts <- function() { - checkIdentical(sample.xts.fts4,as.xts(sample.fts4)) -} -test.convert_fts4_to_xts_j1 <- function() { - checkIdentical(sample.xts.fts4[,1],as.xts(sample.fts4)[,1]) -} -test.convert_fts4_to_xts_i1 <- function() { - checkIdentical(sample.xts.fts4[1,],as.xts(sample.fts4)[1,]) -} -test.convert_fts4_to_xts_i1j1 <- function() { - checkIdentical(sample.xts.fts4[1,1],as.xts(sample.fts4)[1,1]) -} - - -test.fts4_reclass <- function() { - checkIdentical(sample.fts4,reclass(try.xts(sample.fts4))) -} -test.fts4_reclass_subset_reclass_j1 <- function() { - checkIdentical(sample.fts4[,1],reclass(try.xts(sample.fts4))[,1]) -} -test.fts4_reclass_subset_as.xts_j1 <- function() { - checkIdentical(sample.fts4[,1],reclass(try.xts(sample.fts4)[,1])) -} -test.fts4_reclass_subset_fts_j1 <- function() { - checkIdentical(sample.fts4[,1],reclass(try.xts(sample.fts4[,1]))) -} - -# monthly series -sample.fts12 <- ts(sample_matrix,start=1990,frequency=12) -sample.fts12 <- fts::fts(index(sample.fts12), sample_matrix) -sample.xts.fts12 <- as.xts(sample.fts12) - - -test.convert_fts12_to_xts <- function() { - checkIdentical(sample.xts.fts12,as.xts(sample.fts12)) -} -test.convert_fts12_to_xts_j1 <- function() { - checkIdentical(sample.xts.fts12[,1],as.xts(sample.fts12)[,1]) -} -test.convert_fts12_to_xts_i1 <- function() { - checkIdentical(sample.xts.fts12[1,],as.xts(sample.fts12)[1,]) -} -test.convert_fts12_to_xts_i1j1 <- function() { - checkIdentical(sample.xts.fts12[1,1],as.xts(sample.fts12)[1,1]) -} - - -test.fts12_reclass <- function() { - checkIdentical(sample.fts12,reclass(try.xts(sample.fts12))) -} -test.fts12_reclass_subset_reclass_j1 <- function() { - checkIdentical(sample.fts12[,1],reclass(try.xts(sample.fts12))[,1]) -} -test.fts12_reclass_subset_as.xfts_j1 <- function() { - checkIdentical(sample.fts12[,1],reclass(try.xts(sample.fts12)[,1])) -} -test.fts12_reclass_subset_fts_j1 <- function() { - checkIdentical(sample.fts12[,1],reclass(try.xts(sample.fts12[,1]))) -} - -} # requireNamespace diff --git a/man/as.xts.Rd b/man/as.xts.Rd index a6122350..066c96d8 100644 --- a/man/as.xts.Rd +++ b/man/as.xts.Rd @@ -33,7 +33,6 @@ objects into a uniform format for use within \R. It is possible with a call to \code{as.xts} to convert objects of class \code{timeSeries}, \code{ts}, \code{irts}, -\code{fts}, \code{matrix}, \code{data.frame}, and \code{zoo}. \code{xtsible} safely checks whether an object can be converted to diff --git a/man/as.xts.methods.Rd b/man/as.xts.methods.Rd index 03e81d73..1ab9c39b 100644 --- a/man/as.xts.methods.Rd +++ b/man/as.xts.methods.Rd @@ -5,10 +5,8 @@ \alias{as.xts.xts} \alias{as.xts.zoo} \alias{as.xts.ts} -\alias{as.xts.fts} \alias{as.xts.data.frame} \alias{as.xts.matrix} -\alias{as.fts.xts} \title{ Convert Object To And From Class xts } \description{ Conversion S3 methods to coerce data objects of @@ -31,9 +29,6 @@ losing any attributes of the original format. \method{as.xts}{matrix}(x, order.by, dateFormat="POSIXct", frequency=NULL, ..., .RECLASS=FALSE) - - -as.fts.xts(x) } \arguments{ \item{x}{ data object to convert. See details for supported types }