geomorphR/geomorph

Error running example

Closed this issue · 1 comments

Hi, running this example (copy & paste) found in "advanced.procD.lm for pairwise tests and model comparisons" of June 9, 2015 by Mike Collyer, and it throws this error:

library(geomorph)
data(plethodon)
gpa <- gpagen(plethodon$land)
Y <- two.d.array(gpa$coords)
species <- plethodon$species
site <- plethodon$site
fit1 <- lm(Y ~ 1) # effects = intercept
fit2 <- lm(Y ~ species) # effects = intercept + species
advanced.procD.lm(fit1, fit2)

Error in lapply(X = X, FUN = FUN, ...) : object 'dat' not found


I'm using geomorph 3.0.1 on R 3.2.4 Revised (2016-03-16 r70336)

That particular example was performed in an earlier version of geomorph. Since that time, starting with geomorph 3.0.0, the functions can (and should) incorporate geomorph data frames, which are analogous to standard R data.frame but without the constraint that the list must be coerced into a matrix (geomorph.data.frame lists are lists with matching numbers of elements defined by observations in its objects, but do not necessarily constitute rows of a matrix).

The type of error appears to be associated with the function seeking a data frame called "dat". Although we tried to accommodate as much as possible the non-use of geomorph data frames, some cases - perhaps like this - will cause errors. We will look into it, but a quick get-around might be to use a geomorph data frame in the advanced.procD.lm function, as per the examples for that function. (I also recommend updating the script to be more consistent with the current geomorph version, if a clear way to do that is evident.)