Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >PEDATA <- readxl::read_xls()
- >headers <- c("Date","PEValues","lowpeindicator","highpeindicator","inpe")
- >names(PEDATA) <- c(headers)
- >mktdata$PEValues <- PEDATA$PEValues
- >head(mktdata)
- >add.indicator(strategy.name, name = "SMA", arguments =
- list(x=quote(PEValues(mktdata)), n = PEs), label = SMA1)
- > applyStrategy(strategy = strategy.name, portfolios = portfolio.name)
- Error in `colnames<-`(`*tmp*`, value = seq(ncol(tmp_val))) :
- attempt to set 'colnames' on an object with less than two dimensions
- >has.PEValues<- function (x, which = FALSE)
- >{
- > colAttr <- attr(x, "PEValues")
- > if (!is.null(colAttr))
- > return(if (which) colAttr else TRUE)
- > loc <- grep("PEValues", colnames(x), ignore.case = TRUE)
- > if (!identical(loc, integer(0))) {
- > return(if (which) loc else TRUE)
- > }
- > else FALSE
- > }
- >
- >
- >
- > PEValues<- function (x)
- > {
- > if (has.inpe(x))
- > return(x[, grep("PEValues", colnames(x), ignore.case = TRUE)])
- > stop("subscript out of bounds: no column name containing
- >"PEValues"")
- > }
Add Comment
Please, Sign In to add comment