Skip,
It is difficult to troubleshoot this without seeing your full code and data
file. If you send me those off-line I can try to take a look in the near future
to identify what is going on.
Dean
Dr. Dean C. Adams
Professor
Department of Ecology, Evolution, and Organismal Biology
Department of Statistics
Iowa State University
www.public.iastate.edu/~dcadams/<http://www.public.iastate.edu/~dcadams/>
phone: 515-294-3834
From: Phillip Skipwith [mailto:[email protected]]
Sent: Friday, January 5, 2018 4:00 PM
To: MORPHMET <[email protected]>
Subject: [MORPHMET] Issues with subsetting nts array with classifiers and
plotTangentSpace visualization
Hi,
I'm using Geomorph to analyze a 3D landmark dataset. I'm having a number of
issues both in subsetting my array and visualizing these data after Procrustes
analysis. I'm working with a set of 28 specimens and 61 3D landmarks. Below is
a sample of my .dta file from Landmark Editor.
####
trial.coords <- readland.nts('pseudoxy_project3.dta')
1 28L 183 0 Dim=3
C_infralineatus_AMNH165799
D_quadralineatus_AMNH153343
D_quadralineatus_AMNH153345
D_quadralineatus_AMNH160061
..........
-9.8451595e+000 -2.8541670e+000 -2.8408973e+000
-1.0106355e+001 -5.0837624e-001 -1.3406076e+000
-8.7275896e+000 -2.4869413e+000 -1.2266474e+000
-7.3323584e+000 -3.3111162e+000 -3.0307722e+000
..........
I then make classifiers for later grouping and subsetting based on species
(please see below). I can neither subset the data or properly visualize the
resulting PCA plot. I get can error regarding the class of my array dimnames.
Instead of a PCA plot of the designated axes organized by species, I get two 3D
plots of PC1 (positive and negative loadings) with no labeling or legend. Below
is some of my simple code. I'm new to Geomorph, so any help or advice would be
greatly appreciated. If need be, I can send a reduced dataset to help with
troubleshooting.
####
pseudoxy.gpa <- gpagen(trial.coords, ProcD = TRUE, Proj = TRUE, print.progress
= TRUE)
# PCA
categories.qpa <- strsplit(dimnames(pseudoxy.gpa$coords)[[3]], "_")
# unlist into matrix format
classifiers.qpa <- matrix(unlist(categories.qpa), ncol=3, byrow=T)
# add the specimen ID to the first column of the table
classifiers.qpa <- cbind(dimnames(pseudoxy.gpa$coords)[[3]], classifiers.qpa)
# rename the column headings
colnames(classifiers.qpa) <- c("FullID", "Genus", "Species", "ID")
# converts to data frame so can index using $
classifiers.qpa <- as.data.frame(classifiers.qpa)
gp <- as.factor(paste(classifiers.qpa$Genus, classifiers.qpa$Species)) # create
grouping variable
sub.gpa <- coords.subset(A = pseudoxy.gpa$coords, group = gp)
# I get the following error
Error in dimnames(specimens)[[3]] <- names : 'dimnames' must be a list #trying
to coerce dimnames to a list does not help
pseudoxy.PCA <- plotTangentSpace(pseudoxy.gpa$coords, groups = gp, label =
TRUE, legend = TRUE, axis1 = 1, axis2 = 2, warpgrids = TRUE)
# See attachment for confusing plot.
Thanks in advance,
Skip
--
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
[email protected]<mailto:[email protected]>.
--
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
---
You received this message because you are subscribed to the Google Groups
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].