From noreply at r-forge.r-project.org Sat Jul 6 16:42:39 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 6 Jul 2013 16:42:39 +0200 (CEST) Subject: [Xts-commits] r782 - pkg/xts/R Message-ID: <20130706144239.16C5F1846AF@r-forge.r-project.org> Author: bodanker Date: 2013-07-06 16:42:38 +0200 (Sat, 06 Jul 2013) New Revision: 782 Modified: pkg/xts/R/period.R Log: - add checks to period.sum/prod/min/max to ensure INDEX in [0,nrow(x)] Modified: pkg/xts/R/period.R =================================================================== --- pkg/xts/R/period.R 2013-06-27 02:27:03 UTC (rev 781) +++ pkg/xts/R/period.R 2013-07-06 14:42:38 UTC (rev 782) @@ -38,7 +38,7 @@ `period.sum` <- function(x,INDEX) { if(NCOL(x) > 1) stop("single column data only") - + if(min(INDEX) < 0 || max(INDEX) > NROW(x)) stop("INDEX must be >= 0 and <= nrow(x)") ep <- INDEX if(ep[1] != 0) ep <- c(0,ep) if(ep[length(ep)] != NROW(x)) ep <- c(ep,NROW(x)) @@ -58,6 +58,7 @@ `period.prod` <- function(x,INDEX) { if(NCOL(x) > 1) stop("single column data only") + if(min(INDEX) < 0 || max(INDEX) > NROW(x)) stop("INDEX must be >= 0 and <= nrow(x)") ep <- INDEX if(ep[1] != 0) ep <- c(0,ep) if(ep[length(ep)] != NROW(x)) ep <- c(ep,NROW(x)) @@ -77,6 +78,7 @@ `period.max` <- function(x,INDEX) { if(NCOL(x) > 1) stop("single column data only") + if(min(INDEX) < 0 || max(INDEX) > NROW(x)) stop("INDEX must be >= 0 and <= nrow(x)") ep <- INDEX if(ep[1] != 0) ep <- c(0,ep) if(ep[length(ep)] != NROW(x)) ep <- c(ep,NROW(x)) @@ -96,6 +98,7 @@ `period.min` <- function(x,INDEX) { if(NCOL(x) > 1) stop("single column data only") + if(min(INDEX) < 0 || max(INDEX) > NROW(x)) stop("INDEX must be >= 0 and <= nrow(x)") ep <- INDEX if(ep[1] != 0) ep <- c(0,ep) if(ep[length(ep)] != NROW(x)) ep <- c(ep,NROW(x)) From noreply at r-forge.r-project.org Sat Jul 6 18:55:08 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 6 Jul 2013 18:55:08 +0200 (CEST) Subject: [Xts-commits] r783 - pkg/xts/R Message-ID: <20130706165508.CB9F41852E6@r-forge.r-project.org> Author: bodanker Date: 2013-07-06 18:55:08 +0200 (Sat, 06 Jul 2013) New Revision: 783 Modified: pkg/xts/R/indexClass.R Log: - remove empty if(value %in% 'Date') block Modified: pkg/xts/R/indexClass.R =================================================================== --- pkg/xts/R/indexClass.R 2013-07-06 14:42:38 UTC (rev 782) +++ pkg/xts/R/indexClass.R 2013-07-06 16:55:08 UTC (rev 783) @@ -61,10 +61,6 @@ if(value %in% c('POSIXlt','POSIXct')) value <- c(value,'POSIXt') - if(value %in% 'Date') { - - } - attr(x, '.indexCLASS') <- value # all index related meta-data will be stored in the index # as attributes