[Vegan-commits] r2579 - in pkg/vegan: R tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 2 07:29:42 CEST 2013


Author: jarioksa
Date: 2013-08-02 07:29:41 +0200 (Fri, 02 Aug 2013)
New Revision: 2579

Modified:
   pkg/vegan/R/make.commsim.R
   pkg/vegan/tests/oecosimu-tests.Rout.save
Log:
remove redundant sample() of random vectors

Modified: pkg/vegan/R/make.commsim.R
===================================================================
--- pkg/vegan/R/make.commsim.R	2013-08-01 13:43:23 UTC (rev 2578)
+++ pkg/vegan/R/make.commsim.R	2013-08-02 05:29:41 UTC (rev 2579)
@@ -207,7 +207,7 @@
             for (k in seq_len(n)) {
                 out[,,k] <- .C("quasiswap", 
                     m = out[,,k], nr, nc, PACKAGE = "vegan")$m
-                out[,,k][out[,,k] > 0] <- sample(indshuffle(nz - 1L) + 1L)  # we assume that length(nz)>1
+                out[,,k][out[,,k] > 0] <- indshuffle(nz - 1L) + 1L  # we assume that length(nz)>1
             }
             out
         }),
@@ -266,7 +266,7 @@
                     if (length(nz) == 1)
                         out[i,,k][out[i,,k] > 0] <- nz
                     if (length(nz) > 1)
-                        out[i,,k][out[i,,k] > 0] <- sample(indshuffle(nz - 1L) + 1L)
+                        out[i,,k][out[i,,k] > 0] <- indshuffle(nz - 1L) + 1L
                 }
             }
             out
@@ -288,7 +288,7 @@
                     if (length(nz) == 1)
                         out[,j,k][out[,j,k] > 0] <- nz
                     if (length(nz) > 1)
-                        out[,j,k][out[,j,k] > 0] <- sample(indshuffle(nz - 1L) + 1L)
+                        out[,j,k][out[,j,k] > 0] <- indshuffle(nz - 1L) + 1L
                 }
             }
             out

Modified: pkg/vegan/tests/oecosimu-tests.Rout.save
===================================================================
--- pkg/vegan/tests/oecosimu-tests.Rout.save	2013-08-01 13:43:23 UTC (rev 2578)
+++ pkg/vegan/tests/oecosimu-tests.Rout.save	2013-08-02 05:29:41 UTC (rev 2579)
@@ -1564,55 +1564,55 @@
 --> margin rows  shuffle both <--
 grand sum: [1] TRUE
 row sums:  [1] TRUE
-col sums:  [1] "Mean relative difference: 0.7018816"
+col sums:  [1] "Mean relative difference: 0.677024"
 fill:      [1] TRUE
 row freqs: [1] TRUE
 col freqs: [1] TRUE
    Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
-8       3    0    8    0    7       4    0    0    0    0     4    3
-9      12    0    5    5    0      13   10    0    0    0     0    6
-11     12    0    8   11    0       0    5    7    5    9     0    9
-14     13   12   13    0    0       0    0    0   12   14    13    8
-15      3    0   10    0    0       0    0    0    6    2     0    5
-19      9    0    7    0    0       0    0    4    0    8     3    0
-25      5    7    6    0    0       0    0    0    6    6     0    0
-30      4    2    5    0    0       0    0    2    2    0     3    6
-32      8    8    8    0    0       0    0    0    2    0     0    6
-33      9    0   11    0    0       7    0    0    0    0     0   10
-34     11    0    7    8    0       8    6    0    4    7     4   10
-35      3    4    4    0    0       0    0    0    0    9     4    7
-36      6    0    6    0    3       8    8    6    0    0     0    8
-37      9   11    7    0   11       0    0    0    0    0     0    5
-38     19    0   11    0    0      16   15    0    0    0     0   11
-39      9    0    6    0    0       0   10    0    0    0     0    8
-40     21    0   11    0    0       0   16    0   14    0     0    0
-41      0   10    6    0    0       0    0    0    0    0     0    9
-42     17    0   18    0    0      16    0    0    0    0     0    0
-43     12    0   13    0    0       0   14    0   16   15     0    0
-44      0    0   15    0    0       0    0    0    0    0     0   11
-45      6    0   12    0    0       0   10    0    0    0     0    0
-46     11    0    9    0    0       0    0   12    4    8     0    0
-47      0    0   11    0    0       0    8    0    0    0     0    6
-48      9    0   12    0    0       0    0    0    0    0     0    0
-49      8    0   10    0    0       0   10    0    0    0     0    0
-50     13    0    9    0    0       0    0    0    0    0     0   14
-51     11    0    7    0    0       0    0    0    0    0     0    0
-52     13    0   11    0    0       0    0    0    0    5     0    0
-53      4    0   10    0    0       0   11    0    0    9    11    8
-54      7    0    4    0    0       0    0    0    0    5     0    0
-55      0    0    5    0    0       0    6    0    0    7     0    8
-56      9    0    7    0    0       0    0    0    0    0     0    7
-57      0    0    1    0    0       0    0    0    0    0     0    0
-58      0    0   13    0    0       0    8    0    0    5     0    0
-59     14    0    0    0    0       0   11    0    0    0     0    0
-60      9    0    0    0    0       0    0    0   11    0     0    7
-61      4    0    7    5    0       0    0    0    0    0     0    4
-62      1    0    0    0    0       0    0    0    2    0     0    0
-63      6    3   10    0    0       0    9    0    8    1     0    4
-64      8    0    0    0    0       0   12    0    6    0     0    6
-66     17    0    6    4    0       0    8    0    7    9     9    9
-67      0    0  136    0    0       0    0    0    0  135     0    0
-68     11    0    9    0    0       0    0    0    4    0     6    8
+8       8    0    3    0    5      14    0    0    0    0     5    5
+9       7    0    4   12    0      10   10    0    0    0     0    4
+11      6    0    8   13    0       0    8    8   12    8     0    9
+14     14   11    9    0    0       0    0    0   15   15    13   10
+15      5    0    6    0    0       0    0    0    5    5     0    7
+19      5    0    5    0    0       0    0    4    0    4     6    0
+25      5    6    5    0    0       0    0    0    9    6     0    0
+30      5    5    1    0    0       0    0    6    2    0     3    5
+32      6    4    3    0    0       0    0    0    8    0     0    3
+33      7    0    4    0    0       8    0    0    0    0     0   13
+34      9    0   11   10    0       7   11    0    6   13    12    9
+35      6    5   10    0    0       0    0    0    0   10     3   10
+36      8    0    7    0   13       6    4    4    0    0     0    9
+37     14   11    7    0    8       0    0    0    0    0     0    8
+38     17    0   14    0    0      20   12    0    0    0     0   12
+39      7    0    8    0    0       0    8    0    0    0     0   10
+40     14    0   10    0    0       0   12    0   15    0     0    0
+41      0    4    8    0    0       0    0    0    0    0     0    8
+42     15    0   14    0    0      15    0    0    0    0     0    0
+43     12    0   17    0    0       0   11    0   11   15     0    0
+44      0    0    9    0    0       0    0    0    0    0     0   15
+45     13    0   12    0    0       0    6    0    0    0     0    0
+46     10    0   10    0    0       0    0    8    8   15     0    0
+47      0    0   12    0    0       0    8    0    0    0     0    8
+48     12    0    9    0    0       0    0    0    0    0     0    0
+49      7    0   13    0    0       0    7    0    0    0     0    0
+50     12    0    8    0    0       0    0    0    0    0     0   16
+51      2    0    7    0    0       0    0    0    0    0     0    0
+52      4    0    8    0    0       0    0    0    0   11     0    0
+53     11    0    6    0    0       0   10    0    0    9     7    7
+54      7    0    6    0    0       0    0    0    0    4     0    0
+55      0    0    5    0    0       0    6    0    0    2     0    7
+56     10    0   10    0    0       0    0    0    0    0     0   10
+57      0    0    2    0    0       0    0    0    0    0     0    0
+58      0    0   10    0    0       0   10    0    0    5     0    0
+59     15    0    0    0    0       0   13    0    0    0     0    0
+60      3    0    0    0    0       0    0    0    9    0     0    8
+61      4    0    5    6    0       0    0    0    0    0     0    5
+62      3    0    0    0    0       0    0    0    3    0     0    0
+63      6    5    4    0    0       0    7    0    3    4     0   10
+64      8    0    0    0    0       0    5    0    7    0     0    7
+66      8    0    7   10    0       0   11    0    5    7     7    9
+67      0    0  119    0    0       0    0    0    0  134     0    0
+68     11    0    7    0    0       0    0    0    7    0     7   12
 
 ***  swsh  ***
 --> margin columns  shuffle samp <--
@@ -1671,56 +1671,56 @@
 ***  swsh  ***
 --> margin columns  shuffle both <--
 grand sum: [1] TRUE
-row sums:  [1] "Mean relative difference: 0.378733"
+row sums:  [1] "Mean relative difference: 0.3752805"
 col sums:  [1] TRUE
 fill:      [1] TRUE
 row freqs: [1] TRUE
 col freqs: [1] TRUE
    Brachy PHTH HPAV RARD SSTR Protopl MEGR MPRO TVIE HMIN HMIN2 NPRA
-8       8    0    9    0    1       1    0    0    0    0     3    4
-9       6    0   10    7    0       1    5    0    0    0     0    3
-11      8    0   19    1    0       0    4    2    3   10     0    3
-14     12    2    9    0    0       0    0    0    2   11     9    1
-15      7    0   10    0    0       0    0    0    1   12     0    4
-19      5    0   11    0    0       0    0    1    0   13     6    0
-25      8    2   10    0    0       0    0    0    3    9     0    0
-30      7    3    7    0    0       0    0    1    2    0     7    5
-32      8    3   14    0    0       0    0    0    2    0     0    1
-33      9    0    8    0    0       2    0    0    0    0     0    1
-34     11    0   14    5    0       1    5    0    2   10     6    2
-35      8    7   14    0    0       0    0    0    0    8     6    2
-36     11    0    7    0    1       2    5    1    0    0     0    3
-37      7    2   10    0    2       0    0    0    0    0     0    2
-38     13    0   12    0    0       1    6    0    0    0     0    5
-39      8    0    8    0    0       0    4    0    0    0     0    3
-40      8    0    7    0    0       0    9    0    2    0     0    0
-41      0    4   11    0    0       0    0    0    0    0     0    4
-42      5    0   13    0    0       1    0    0    0    0     0    0
-43     10    0    8    0    0       0    6    0    2   11     0    0
-44      0    0    8    0    0       0    0    0    0    0     0    5
-45      6    0   11    0    0       0    7    0    0    0     0    0
-46      6    0   10    0    0       0    0    1    4   12     0    0
-47      0    0   17    0    0       0    6    0    0    0     0    6
-48     13    0    8    0    0       0    0    0    0    0     0    0
-49      6    0    8    0    0       0    3    0    0    0     0    0
-50      9    0    6    0    0       0    0    0    0    0     0    5
-51      5    0   15    0    0       0    0    0    0    0     0    0
-52     11    0   13    0    0       0    0    0    0   10     0    0
-53      4    0   11    0    0       0    5    0    0   10     7    1
-54      6    0   10    0    0       0    0    0    0    9     0    0
-55      0    0   11    0    0       0    4    0    0    7     0    4
-56      6    0    8    0    0       0    0    0    0    0     0    2
-57      0    0    8    0    0       0    0    0    0    0     0    0
-58      0    0   14    0    0       0    2    0    0    8     0    0
-59      5    0    0    0    0       0    1    0    0    0     0    0
-60      5    0    0    0    0       0    0    0    3    0     0    2
-61      4    0   12    1    0       0    0    0    0    0     0    1
-62      9    0    0    0    0       0    0    0    1    0     0    0
-63     17    4   19    0    0       0    7    0    6   18     0    1
-64      8    0    0    0    0       0    3    0    5    0     0    3
-66     13    0   11    2    0       0    6    0    1   10     7    1
-67      0    0    8    0    0       0    0    0    0   11     0    0
-68      7    0   11    0    0       0    0    0    2    0     7    2
+8      11    0    9    0    2       1    0    0    0    0     5    3
+9       5    0   10    3    0       2    3    0    0    0     0    6
+11      7    0    9    3    0       0    3    1    4   10     0    1
+14     17    3    5    0    0       0    0    0    2   14     7    3
+15      7    0   13    0    0       0    0    0    2   14     0    1
+19      8    0   16    0    0       0    0    1    0    8    10    0
+25      5    5    7    0    0       0    0    0    5   11     0    0
+30      9    3    6    0    0       0    0    1    1    0     7    1
+32      7    3   16    0    0       0    0    0    2    0     0    4
+33      8    0   10    0    0       1    0    0    0    0     0    1
+34      4    0   15    3    0       1    7    0    2   11     4    5
+35      9    5   10    0    0       0    0    0    0   13     7    3
+36      6    0   15    0    1       1    2    1    0    0     0    5
+37      8    3   10    0    1       0    0    0    0    0     0    2
+38      6    0   11    0    0       2    5    0    0    0     0    7
+39      5    0   11    0    0       0    5    0    0    0     0    1
+40      9    0   13    0    0       0    4    0    4    0     0    0
+41      0    3   10    0    0       0    0    0    0    0     0    1
+42      8    0    8    0    0       1    0    0    0    0     0    0
+43      8    0   14    0    0       0    4    0    2   11     0    0
+44      0    0   14    0    0       0    0    0    0    0     0    5
+45     13    0   12    0    0       0    4    0    0    0     0    0
+46      8    0    9    0    0       0    0    2    3   11     0    0
+47      0    0    8    0    0       0    6    0    0    0     0    1
+48      4    0    9    0    0       0    0    0    0    0     0    0
+49     13    0   11    0    0       0    3    0    0    0     0    0
+50     11    0   15    0    0       0    0    0    0    0     0    1
+51     11    0   10    0    0       0    0    0    0    0     0    0
+52      5    0    6    0    0       0    0    0    0    4     0    0
+53     13    0   15    0    0       0    6    0    0   13     6    2
+54      6    0   11    0    0       0    0    0    0    6     0    0
+55      0    0   10    0    0       0   11    0    0    8     0    1
+56      7    0    7    0    0       0    0    0    0    0     0    3
+57      0    0    9    0    0       0    0    0    0    0     0    0
+58      0    0   17    0    0       0   10    0    0   11     0    0
+59     10    0    0    0    0       0    3    0    0    0     0    0
+60      6    0    0    0    0       0    0    0    1    0     0    5
+61      6    0    9    4    0       0    0    0    0    0     0    4
+62      6    0    0    0    0       0    0    0    2    0     0    0
+63      8    2    6    0    0       0    3    0    1   10     0    4
+64     12    0    0    0    0       0    6    0    4    0     0    2
+66      5    0   13    3    0       0    3    0    4   13     6    3
+67      0    0   10    0    0       0    0    0    0   11     0    0
+68      8    0   11    0    0       0    0    0    2    0     6    1
 
 ***  abuswap  ***
 --> margin rows  shuffle samp <--
@@ -1979,4 +1979,4 @@
 > 
 > proc.time()
    user  system elapsed 
-  2.390   0.228   2.623 
+  2.317   0.220   2.504 



More information about the Vegan-commits mailing list