[R] AMOVA error: 'bin' must be numeric or a factor

Hanne Ballestad hanne.ballestad at bio.uio.no
Sat Feb 11 19:13:51 CET 2012


 Hi!

 I am trying to analyse my data using amova 
 (http://www.oga-lab.net/RGM2/func.php?rd_id=pegas:amova):

 My input to R is a DNA sequence file, format=fasta
 	dna<- read.dna("XX.fasta", format="fasta") #left other options as 
 default
 	d<- dist.dna(dna, model="raw")
 	g<- read.table("XXX.design")

 Load necessary libraries:
 	library(pegas)
 	Loading required package: adegenet
 	Loading required package: MASS
 	Loading required package: ade4

 Running Amova:
 amova(d ~ g, nperm = 100)
 Error in FUN(X[[1L]], ...) : 'bin' must be numeric or a factor


 How can I solve this "bin" problem?
 I think it might be a problem with the g variabel. In the example they 
 type
 g <- factor(c(rep("A", 7), rep("B", 8)))

 I cannot find any information about what this c(rep....) does. Do 
 anyone know about a proper manual for the amova function?
 My input file for g looks like this:

 sequenceA	1
 sequenceB	1
 sequenceC	1
 .
 .
 .
 .
 sequenceD	5
 .
 .

 sequenceE	9
 sequenceF	9


 Where sequenceA is in group 1, sequenceD is in group 5 and so on...

 If I type is.factor(g)
 I get FALSE

 I have also checked that the d (a matrix file) is a numeric file. It 
 should be correct.

 is.numeric(d)
 TRUE


 Any help will be very much appreciated!

 Cheers,

 Hanne



More information about the R-help mailing list