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

# S3 method for class '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.18458 
#> ... Procrustes: rmse 0.04934384  max resid 0.1574557 
#> Run 2 stress 0.1948413 
#> Run 3 stress 0.2109614 
#> Run 4 stress 0.1974421 
#> Run 5 stress 0.18584 
#> Run 6 stress 0.2212139 
#> Run 7 stress 0.2104991 
#> Run 8 stress 0.2085949 
#> Run 9 stress 0.1843196 
#> ... Procrustes: rmse 4.017075e-05  max resid 0.0001549597 
#> ... Similar to previous best
#> Run 10 stress 0.2102718 
#> Run 11 stress 0.1967393 
#> Run 12 stress 0.1955836 
#> Run 13 stress 0.22964 
#> Run 14 stress 0.1825658 
#> ... New best solution
#> ... Procrustes: rmse 0.04162943  max resid 0.1518165 
#> Run 15 stress 0.1852397 
#> Run 16 stress 0.1843196 
#> Run 17 stress 0.2447739 
#> Run 18 stress 0.1948414 
#> Run 19 stress 0.1967393 
#> Run 20 stress 0.2199834 
#> *** Best solution was not repeated -- monoMDS stopping criteria:
#>     19: stress ratio > sratmax
#>      1: scale factor of the gradient < sfgrmin
fit <- envfit(ord, varechem, perm = 199)

fortify(fit)
#>       label   type       NMDS1      NMDS2
#> 1         N Vector -0.02885460 -0.5028066
#> 2         P Vector  0.27282423  0.3455426
#> 3         K Vector  0.32600362  0.2732355
#> 4        Ca Vector  0.43971910  0.4674548
#> 5        Mg Vector  0.41332647  0.5061631
#> 6         S Vector  0.08009496  0.4108345
#> 7        Al Vector -0.63272378  0.3558210
#> 8        Fe Vector -0.62446795  0.2347619
#> 9        Mn Vector  0.57767472 -0.4351499
#> 10       Zn Vector  0.26769928  0.3409494
#> 11       Mo Vector -0.22294152  0.1060196
#> 12 Baresoil Vector  0.46318828 -0.1903747
#> 13 Humdepth Vector  0.67273086 -0.2597792
#> 14       pH Vector -0.31132379  0.3658781

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