I am getting following error when running this script :------------Error in
length(runsum) : object 'runsum' not found


##error function
dat$fit <- NULL
dat$fit[dat$majorlandmarks] <- dat$Close[dat$majorlandmarks]
run <- rle(dat$majorlandmarks)
runvalue <- run$values
runsum <- cumsum(run$lengths)
run <- run$lengths
for(i in 1:(length(runsum)-1)){
  if (runvalue[i]==FALSE){
    left <- runsum[i-1]
    right <- runsum[i+1]-(run[i+1]-1)

    slope <- (dat$Close[dat$seq==right]-dat$Close[dat$seq==left])/(run[i]+1)
    dat$fit[(left+1):(right-1)] <- seq(1:run[i])*slope+dat$Close[left]

  }
return(dat)
}

Error in length(runsum) : object 'runsum' not found


Error in length(runsum) : object 'runsum' not found

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to