Hi list, I am using the capscale function in vegan_2.0-7 to do a constrained principal coordinates analysis, and I kept getting the following error message: Error in Y.r[, oo, drop = FALSE] : subscript out of bounds I googled but I couldn't find an answer. Could anyone tell me why this error msg and what to do? Here is the command I used: mod=capscale(as.dist(dist)~mydataset$Var1+Condition(mydataset$Var2)) My dataset looks like the output of column-binding the 'varespec' and 'varechem' datasets, and has 92 rows and about 3500 columns. I also fed capscale a similarity matrix in the formula. Here is more info on the R version and the OS: R version 3.0.1 (2013-05-16) Platform: x86_64-w64-mingw32/x64 (64-bit) Thanks a lot for any help or comment, Zhao -- Zhao JIN Ph.D. Candidate Ruth Ley Lab 467 Biotech Field of Microbiology, Cornell University Lab: 607.255.4954 Cell: 412.889.3675 [[alternative HTML version deleted]]
Zhao Jin <zj29 <at> cornell.edu> writes:> I am using the capscale function in vegan_2.0-7 to do a constrained > principal coordinates analysis, and I kept getting the following error > message: > Error in Y.r[, oo, drop = FALSE] : subscript out of bounds > > I googled but I couldn't find an answer. Could anyone tell me why this > error msg and what to do? > > Here is the command I used: > mod=capscale(as.dist(dist)~mydataset$Var1+Condition(mydataset$Var2)) > > My dataset looks like the output of column-binding the 'varespec' and > 'varechem' datasets, and has 92 rows and about 3500 columns. I also fed > capscale a similarity matrix in the formula.Dear Zhao Jin, This is irreproducible. I have tried several ways of giving wrong data or definition to capscale() and have been able to generate several different error messages, but not this one. We need more hints. Moreover, if 'dist' are distances (dissimilarities), you do not need as.dist() for them, and the formula takes a 'data' argument, so that you can write: capscale(dist ~ Var1 + Condition(Var2), mydataset) I would start at looking how 'dist' and 'mydataset' look like, and what are 'Var1' and 'Var2'. Cheers, Jari Oksanen
Dear Jari, Thanks a lot for your reply. Let me describe more about my dataset: it consists of count data for samples, and shows how many copies of a certain bacteria are in a sample. There are 92 samples (rows), and about 3500 kinds of bacteria (columns). Variable 1 (Var1) is a factor indicating the types of samples, and Var2 is a factor showing the locations the samples were collected. 'dist' is an unweighted UniFrac distance matrix. I probably have figured out how to fix the error: I had only 1 level for Var2. When I tried my command on a bigger table with 2 levels for Var2, it worked. However, I am not sure why specifically I got the 'subscript out of bounds' error previously. Regards, Zhao [[alternative HTML version deleted]]