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]] ______________________________________________ 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.