[adegenet-forum] DAPC on morphometric data

Jombart, Thibaut t.jombart at imperial.ac.uk
Wed Dec 8 03:07:24 CET 2010


Dear Dietrich, 

thanks for sending me the data off the ML. That's an other typo I did not spot: for non-genetic data (data.frame, matrix arguments), the group argument is named 'grp', and not 'pop' as for the genind method. So you need to use:
dapc <- dapc(data, grp=grp$grp, n.pca=NULL, n.da=NULL)

Cheers

Thibaut
________________________________________
From: Gotzek, Dietrich [GotzekD at si.edu]
Sent: 07 December 2010 20:57
To: Jombart, Thibaut; adegenet-forum at lists.r-forge.r-project.org
Subject: RE: DAPC on morphometric data

Duh! Thanks and my apologies, you are right of course!
But now I get the following error message:

> data <- as.matrix(read.csv("/Users/dgotzek/morphometric.csv", header=F, sep = ","))
> grp <- find.clusters(data, n.pca=NULL, n.clust=NULL)
Choose the number PCs to retain (>=1):
8
Choose the number of clusters (>=2:
3
> dapc <- dapc(data, pop=grp$grp, n.pca=NULL, n.da=NULL)
Error in .Internal(inherits(x, what, which)) : 'x' is missing

Thanks,
Dietrich


Dietrich Gotzek
Department of Entomology
National Museum of Natural History
Smithsonian Institution
PO Box 37012, MRC 188, NHB, Rm. CE-509
Washington, DC 20013-7012

phone: (202) 633-1003
email: gotzekd at si.edu
________________________________________
From: Jombart, Thibaut [t.jombart at imperial.ac.uk]
Sent: Tuesday, December 07, 2010 3:50 PM
To: Gotzek, Dietrich; adegenet-forum at lists.r-forge.r-project.org
Subject: RE: DAPC on morphometric data

Dear Dietrich,

It seems to be a typo; you did not perform the DAPC on your morphometric data, but tried it on on a list called grp.
Try:
morph.dapc <- dapc(morph.data, pop=morph.clust$grp, n.pca=NULL, n.da=NULL)

Cheers

Thibaut
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of Gotzek, Dietrich [GotzekD at si.edu]
Sent: 07 December 2010 19:24
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] DAPC on morphometric data

Hi,
I'd like to know if anyone has tried using DAPC on morphometric data, as mentioned in the paper. I've tried (unsuccessfully), using a dataset of 30 individuals and 14 measurements with the following commands:

> morph.data <- as.matrix(read.csv("/Users/dgotzek/morphometric.csv", header=F, sep = ","))
> morph.clust <- find.clusters(morph.data, n.pca=NULL, n.clust=NULL)
Choose the number PCs to retain (>=1):
8
Choose the number of clusters (>=2:
3
> morph.dapc <- dapc(grp, pop=morph.clust$grp, n.pca=NULL, n.da=NULL)
Error in UseMethod("dapc") :
  no applicable method for 'dapc' applied to an object of class "list"

I was surprised by this, so I asked:
> is.matrix(morph.data)
[1] TRUE

The dapc help function states that "dapc performs the DAPC on a data.frame, a matrix, or a genind object, and returns an object with class dapc. If data are stored in a data.frame or a matrix, these have to be quantitative data (i.e., numeric or integers), as opposed to characters or factors.", which is given in my case. So what am I doing wrong? I tried various was to import various formats of the data (read.table, read.csv, etc), but nothing worked...

Any help is appreciated!
Thanks,
Dietrich

Dietrich Gotzek
Department of Entomology
National Museum of Natural History
Smithsonian Institution
PO Box 37012, MRC 188, NHB, Rm. CE-509
Washington, DC 20013-7012

phone: (202) 633-1003
email: gotzekd at si.edu
_______________________________________________
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum


More information about the adegenet-forum mailing list