Hello!

I have a piece of slow code and I am wondering if I am missing some obvious way
to make it faster -- or if there is some predefined function I should be using
instead.

I have a list (ranks), for which I would like to compute the probability of a
bunch of values (dereg) being contained in ranks[1:i]

prob=function(x,ranks,dereg){

        revranks=ranks[1:x]
        p=length(which(dereg %in% revranks))/length(dereg)
        return(p)
}

probdist=lapply(c(2:5166),prob,ranks=r,dereg=list)

Takes a long time... too long to do a meaningful number of permutations.

Thanks!!!
--Kamila


The information transmitted in this electronic communication...{{dropped}}

______________________________________________
R-help@stat.math.ethz.ch mailing list
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