From 24a3ba393fccd6ea385e6f7a2b438047dfa96626 Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Thu, 2 Feb 2023 15:13:38 -0600 Subject: [PATCH] Revert "Add rowMeans.xts() and rowSums.xts()" This reverts commit acf204cfe7744e766bae1322b6cf86502ed22b34. I don't like that these mask the base functions, and I prefer the more general solution in #380. See #281. --- NAMESPACE | 7 ----- R/rowFunctions.R | 80 ------------------------------------------------ 2 files changed, 87 deletions(-) delete mode 100644 R/rowFunctions.R diff --git a/NAMESPACE b/NAMESPACE index 49222692..8ba43c51 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -274,13 +274,6 @@ S3method(cummax, xts) #S3method(lagts,xts) S3method(rollapply, xts) -export(rowSums) -S3method(rowSums, xts) -S3method(rowSums, default) -export(rowMeans) -S3method(rowMeans, xts) -S3method(rowMeans, default) - # list specific methods S3method(as.list,xts) diff --git a/R/rowFunctions.R b/R/rowFunctions.R deleted file mode 100644 index 12a1855a..00000000 --- a/R/rowFunctions.R +++ /dev/null @@ -1,80 +0,0 @@ -# -# xts: eXtensible time-series -# -# Copyright (C) 2022 Joshua M. Ulrich josh.m.ulrich @ gmail.com -# -# 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 . - -rowSums <- -function(x, - na.rm = FALSE, - dims = 1L, - ...) -{ - UseMethod("rowSums") -} - -rowSums.default <- -function(x, - na.rm = FALSE, - dims = 1L, - ...) -{ - base::rowSums(x, na.rm, dims) -} - -rowSums.xts <- - function(x, - na.rm = FALSE, - dims = 1L, - ..., - name = "sum") -{ - r <- matrix(rowSums(coredata(x), na.rm = na.rm, dims = dims)) - xcoredata(r) <- xcoredata(x) - colnames(r) <- name - return(r) -} - -rowMeans <- -function(x, - na.rm = FALSE, - dims = 1L, - ...) -{ - UseMethod("rowMeans") -} - -rowMeans.default <- -function(x, - na.rm = FALSE, - dims = 1L, - ...) -{ - base::rowMeans(x, na.rm, dims) -} - -rowMeans.xts <- - function(x, - na.rm = FALSE, - dims = 1L, - ..., - name = "mean") -{ - r <- matrix(rowMeans(coredata(x), na.rm = na.rm, dims = dims)) - xcoredata(r) <- xcoredata(x) - colnames(r) <- name - return(r) -} -