Error running formatsitepair function
catarras opened this issue · comments
Dear Fitzpatrick Lab,
First, thanks for this great package. I am experiencing an issue when running the function formatsitepair
. As biological data, I use a dissimilarity matrix, and as environmental predictor I use a distance matrix with the argument distPreds. As the formatsitepair
function does not accept only distances matrices as predictors, I provide one fake predictor for the argument predData what includes coordinate columns and a fake variable. However, it returns the following error:
Error in if ((dim(mat1)[1] != dim(mat)[1]) & (dim(mat1)[2] != dim(mat)[2])) { :
argument is of length zero
This is my code, and I attach the input files:
sim <- read.table("sim.txt", h=T)
euc= read.table("euc.txt", h=T)
fake= read.table("fake.txt", h=T)
simdata = formatsitepair(bioData=sim, bioFormat=3, predData=fake, distPreds=euc, XColumn="x", YColumn="y", siteColumn="site")
I am not able to find what I am doing wrong here.
Many tanks in advance,
Pedro
See the last two examples in the help docs for formatsitepair
. This should work:
sp1 <- formatsitepair(sim, 3, XColumn="x", YColumn="y", predData=fake, siteColumn="site")
sp2 <- formatsitepair(sp1, 4, predData=fake, siteColumn="site", distPreds=list(as.matrix(euc)))
Yes. This works. Thanks!