[R] [rmetasim] Need help deciphering this error msg... targeted to those who use rmetasim...
Brian Seok
mondorescue at yahoo.fr
Fri Oct 29 21:19:13 CEST 2004
Hello,
I am trying to do some simulation using the rmetasim
package and I've run to this problem.
--beginning of error msg--
Error in "[<-"(`*tmp*`, slice[l, ], slice[l, ], value
= c(0.200000002980232, :
number of items to replace is not a multiple
of replacement length
--end of error msg--
Here is the script I used.
--script starts here--
## load 'rmetasim' library
library(rmetasim)
penguinland <- new.landscape.empty()
penguinland <- new.intparam.land(penguinland,h=2,s=3)
penguinland <- new.floatparam.land(penguinland,s=0)
penguinland <- new.switchparam.land(penguinland,mp=0)
## local matrices are 3x3 (or greater than 2x2)
matrixR <- matrix( c(rep(0.2, 3*3)),
ncol=3,nrow=3,byrow=TRUE )
matrixS <- matrix( c(rep(0.1, 3*3)),
ncol=3,nrow=3,byrow=TRUE )
matrixM <- matrix( c(1.0, 0.0, 1.0, 0.0, 1.0, 0.0,
1.0, 0.0, 1.0), ncol=3,nrow=3,byrow=TRUE )
penguinland <-
new.local.demo(penguinland,matrixR,matrixS,matrixM)
matrixRR <- matrix( c(rep(0,6*6)),
ncol=6,nrow=6,byrow=TRUE )
matrixSS <- matrix( c(rep(0,6*6)),
ncol=6,nrow=6,byrow=TRUE )
matrixMM <- matrix( c(rep(0,6*6)),
ncol=6,nrow=6,byrow=TRUE )
penguinland <-
new.epoch(penguinland,matrixRR,matrixSS,matrixMM)
penguinland <- new.locus(penguinland)
penguinland <- new.individuals(penguinland, c(6, 4, 4,
3, 2, 5))
## i get error here when simulate.landscape()
executed...
#+
#+ ERROR MSG:
#+
#+ Error in "[<-"(`*tmp*`, slice[l, ], slice[l, ],
value = c(0.200000002980232, :
#+ number of items to replace is not a
multiple of replacement length
#+
penguinland <- simulate.landscape(penguinland, 4)
--script ends here--
As noted in the script, when the matrixR, matrixS,
matrixM are size greater than 2x2, the script fails to
execute at the simulate.landscape()
Here is the script with the 2x2 R,S,M matrices.
--script starts here--
## load 'rmetasim' library
library(rmetasim)
penguinland <- new.landscape.empty()
penguinland <- new.intparam.land(penguinland,h=2,s=2)
penguinland <- new.floatparam.land(penguinland,s=0)
penguinland <- new.switchparam.land(penguinland,mp=0)
## local matrices are 2x2
matrixR <- matrix( c(0.2, 0.2, 0.2, 0.2),
ncol=2,nrow=2,byrow=TRUE )
matrixS <- matrix( c(0.1, 0.1, 0.1, 0.1),
ncol=2,nrow=2,byrow=TRUE )
matrixM <- matrix( c(1.0, 0.0, 1.0, 0.0),
ncol=2,nrow=2,byrow=TRUE )
penguinland <-
new.local.demo(penguinland,matrixR,matrixS,matrixM)
matrixRR <- matrix( c(rep(0,4*4)),
ncol=4,nrow=4,byrow=TRUE )
matrixSS <- matrix( c(rep(0,4*4)),
ncol=4,nrow=4,byrow=TRUE )
matrixMM <- matrix( c(rep(0,4*4)),
ncol=4,nrow=4,byrow=TRUE )
penguinland <-
new.epoch(penguinland,matrixRR,matrixSS,matrixMM)
penguinland <- new.locus(penguinland)
penguinland <- new.individuals(penguinland, c(6, 4, 4,
3))
## when local matrices are 2x2, it works!
penguinland <- simulate.landscape(penguinland, 4)
--script ends here--
This works. I've tried various things, like change
other parts of the script, e.g. changing the
new.locus(), eventually I got an error msg similar,
instead of " number of items to replace is not
a multiple of replacement length" but with something
about the ape package.
If someone can decipher this error msg for me, then I
maybe able to work around it or correct it or findout
what I'M doing wrong.
Any help would be greatly appreciated thanks!
Brian S.
Vous manquez dÂespace pour stocker vos mails ?
More information about the R-help
mailing list