first preallocate 'm' to the max (m <- numeric(nr)) and then run Rprof to
see where time is being spent. Since there was not reproducible data
provided, it is hard to analyze beyond this point. Time is probably being
spent in one of the functions
On Tue, Jun 10, 2008 at 4:49 AM, Marc wrote:
> Hi,
>
> I have the following function that I want to apply to a list of 14 matrices
> (1536 x 170) of binary data:
>
> DRes <- function(x, nr = 10000, metric = "mixed", ...) {
> require(analogue)
> require(ade4)
> m <- c()
> for (i in 1:nr) {
> set.seed(i)
> x1 <- x[, sample(dimnames(x)[[2]], length(x[1,])/2)]
> x2 <- x[, !dimnames(x)[[2]] %in% dimnames(x1)[[2]]]
> d1 <- as.dist(distance(as.data.frame(x1), method = metric))
> d2 <- as.dist(distance(as.data.frame(x2), method = metric))
> m[i] <- mantel.rtest(d1, d2, ...)$obs
> mean <- mean(m)
> std <- sd(m)
> res <- list(mean = mean, std = std)
> }
> return(res)
> }
> bias.dres <- sapply(bias, DRes)
>
> I run this code and after 3 hours is still running. I am on Windows XP and
> this is my sessionInfo()
> > sessionInfo()
> R version 2.7.0 Patched (2008-05-02 r45580)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> Kingdom.1252;LC_MONETARY=English_United
> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
> other attached packages:
> [1] analogue_0.5-1 vegan_1.11-4 ade4_1.4-7
> Any help will be very much appreciated.
> Marc.
>
> ______________________________________________
> R-help@r-project.org 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
[[alternative HTML version deleted]]