https://github.com/cran/quantmod
Revision 65a1956a0c8ce499f7ce2197e1cdcee76bfdb1ed authored by Jeffrey A. Ryan on 09 June 2008, 00:00:00 UTC, committed by Gabor Csardi on 09 June 2008, 00:00:00 UTC
1 parent a3d051a
Tip revision: 65a1956a0c8ce499f7ce2197e1cdcee76bfdb1ed authored by Jeffrey A. Ryan on 09 June 2008, 00:00:00 UTC
version 0.3-6
version 0.3-6
Tip revision: 65a1956
breakpoints.R
"breakpoints" <-
function(x,by=c(weekdays,weeks,months,quarters,years),...) {
if(length(by) != 1) stop('choose ONE method for "by"')
# by.arg <- match.arg(substitute(by),c("weekdays","weeks","months","quarters","years"));
# by <- eval(parse(text=by.arg));
# if(is.na(pmatch(deparse(substitute(by)),c("weekdays","weeks","months","quarters","years"))))
# stop("by must be weekdays,weeks,months,quarters, or years");
by <- match.fun(by);
breaks <- which(diff(as.numeric(by(x,...))) != 0);
# nr <- ifelse(inherits(x,'POSIXt'),NROW(x[[1]]),NROW(x))
nr <- NROW(x)
breaks <- c(0,breaks,nr);
return(breaks);
}
Computing file changes ...