gg_lvsplot_data: Prepare data to plot latent variables from a boral model

Description Usage Arguments Value See Also Examples

Description

This function takes a fitted boral model and returns a data frame to use with ggplot for an ordination-style bi-plot of latent variables and coefficients. It is used by function gg_lvsplot but you can also use it directly.

Usage

1
gg_lvsplot_data(model, scaling = 1)

Arguments

model

A boral model fitted with one or more latent variables.

scaling

A numeric value between 0.8 and 1.2 that controls the relative scaling of latent variables (e.g. sites) and latent variable coefficients (e.g. species).

Value

A data frame with n column(s) for the values of the n latent variables; a column var specifying whether a row is for latent variable ('lv') or coefficient ('lvcoef') values; and a column label giving object (e.g. site) name for 'lv' rows and attribute (e.g. species) name for 'lvcoef' rows.

See Also

gg_lvsplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
dat.gg <- gg_lvsplot_data(mymodel)

# Draw 'manually' with ggplot as an alternative to using
# the gg_lvsplot function
library(ggplot2)
library(ggrepel)

ggplot(data = dat.gg, aes(x = lv1, y = lv2, colour = var)) +
  geom_point() +
  geom_text_repel(aes(label = label)) +
  theme(legend.position = "none")

## End(Not run)

mbedward/ggboral documentation built on June 27, 2020, 10:15 a.m.