The geomorph.data.frame function produces a list object
that can be used similarly to a data frame and input into many geomorph
functions. Objects that can be coersed into a geomorph data frame
include Procrustes shape variables, matrices, factors, variables, and
phylogenetic trees.
geomorph.data.frame() (Expand for more details)
By way of example below we show the use of this function with a set
of landmarks (lmks) and two variables (spec, site).
df <- geomorph.data.frame(lmks = plethodon$land, species = plethodon$species)
One can access elements within a geomorph data frame in the same way one would with a regular list; using the sub component name double parentheses ([[]]):
df$lmks[,,1] #This will print the landmark coordinates of the first specimen
## [,1] [,2]
## [1,] 8.89372 53.77644
## [2,] 9.26840 52.77072
## [3,] 5.56104 54.21028
## [4,] 1.87340 52.75100
## [5,] 1.28180 53.18484
## [6,] 1.24236 53.32288
## [7,] 0.84796 54.70328
## [8,] 3.35240 55.76816
## [9,] 6.29068 55.70900
## [10,] 8.87400 55.25544
## [11,] 10.74740 55.43292
## [12,] 14.39560 52.75100
df[[2]] #This will print the second object in the data frame, the factor with species information
## [1] Jord Jord Jord Jord Jord Jord Jord Jord Jord Jord Teyah Teyah Teyah Teyah Teyah Teyah Teyah
## [18] Teyah Teyah Teyah Jord Jord Jord Jord Jord Jord Jord Jord Jord Jord Teyah Teyah Teyah Teyah
## [35] Teyah Teyah Teyah Teyah Teyah Teyah
## Levels: Jord Teyah
What can go into a geomorph data frame is constrained only by the number of observations, or individuals, (n) in your dataset. In other words, all objects that you wish to coerce into the data frame must have matching numbers of individuals for the function to work.