Displaying 2 results from an estimated 2 matches for "runvalue".
2017 Sep 27
1
Need Help in Debugging
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...
2009 Sep 08
5
sparse vectors
Hi
I deal with long vectors almost all of whose elements are zero.
Typically, the length will be ~5e7 with ~100 nonzero elements.
I want to deal with these objects using a sort of sparse
vector.
The problem is that I want to be able to 'add' two such
vectors.
Toy problem follows. Suppose I have two such objects, 'a' and 'b':
> a
$index
[1] 20 30 100000000