Produces a tidy data frame from the results of an envfit object.

# S3 method for envfit
fortify(model, data, ...)

Arguments

model

an object of class envfit, the result of a call to envfit.

data

additional data to augment the envfit results. Currently ignored.

...

arguments passed to scores.envfit.

Value

A data frame with columns label, type, containing the label for, and whether each row refers to, the fitted vector or factor. Remaining variables are coordinates on the respective ordination axes returned by scores.envfit.

Author

Gavin L. Simpson

Examples

data(varespec, varechem)
ord <- metaMDS(varespec)
#> Square root transformation
#> Wisconsin double standardization
#> Run 0 stress 0.1843196 
#> Run 1 stress 0.2394977 
#> Run 2 stress 0.2085514 
#> Run 3 stress 0.1948413 
#> Run 4 stress 0.1985581 
#> Run 5 stress 0.2541419 
#> Run 6 stress 0.2253395 
#> Run 7 stress 0.2200285 
#> Run 8 stress 0.1843196 
#> ... New best solution
#> ... Procrustes: rmse 1.989378e-05  max resid 7.970139e-05 
#> ... Similar to previous best
#> Run 9 stress 0.1825658 
#> ... New best solution
#> ... Procrustes: rmse 0.04161526  max resid 0.1517552 
#> Run 10 stress 0.2230072 
#> Run 11 stress 0.2160285 
#> Run 12 stress 0.2109615 
#> Run 13 stress 0.1825658 
#> ... Procrustes: rmse 1.670552e-05  max resid 3.979495e-05 
#> ... Similar to previous best
#> Run 14 stress 0.2109006 
#> Run 15 stress 0.1948413 
#> Run 16 stress 0.2028828 
#> Run 17 stress 0.2080756 
#> Run 18 stress 0.1948413 
#> Run 19 stress 0.2673294 
#> Run 20 stress 0.2313657 
#> *** Best solution repeated 1 times
fit <- envfit(ord, varechem, perm = 199)

fortify(fit)
#>       label   type       NMDS1      NMDS2
#> 1         N Vector -0.02884261 -0.5028122
#> 2         P Vector  0.27281935  0.3455383
#> 3         K Vector  0.32599243  0.2732269
#> 4        Ca Vector  0.43970585  0.4674607
#> 5        Mg Vector  0.41331452  0.5061694
#> 6         S Vector  0.08008409  0.4108305
#> 7        Al Vector -0.63271809  0.3558146
#> 8        Fe Vector -0.62445871  0.2347342
#> 9        Mn Vector  0.57765899 -0.4351762
#> 10       Zn Vector  0.26769898  0.3409650
#> 11       Mo Vector -0.22294289  0.1060272
#> 12 Baresoil Vector  0.46317916 -0.1903682
#> 13 Humdepth Vector  0.67271180 -0.2598022
#> 14       pH Vector -0.31130791  0.3658913

data(dune, dune.env)
ord <- cca(dune)
fit <- envfit(ord ~ Moisture + A1, dune.env, perm = 199)

fortify(fit)
#>       label     type        CA1         CA2
#> 1        A1   Vector -0.5560989 -0.03376924
#> 2 Moisture1 Centroid  0.7484337  0.14227818
#> 3 Moisture2 Centroid  0.4651928  0.21556841
#> 4 Moisture4 Centroid -0.1826781  0.73151540
#> 5 Moisture5 Centroid -1.1142548 -0.57080238