knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
As an example, the spider data set is used for ordination. First the abundance data is converted to presence/absence.
#library(mvabund) #library(knitr) #library(dplyr) #install_github('andyhoegh/UncertainOrd') #library(UncertainOrd) #library(tidyr) #library(ggplot2) data(spider, package='mvabund') spider.matrix <- matrix(as.numeric(spider$abund > 0), nrow = 28, ncol = 12) knitr::kable(spider.matrix, col.names = colnames(spider$abund))
The latent factor model is used for ordination.
ord <- UncertainOrd::ordinate_probit(500, spider.matrix)
Using the output from the model above, we can create ordination figures.
UncertainOrd::CredibleViz(ord$z.samples[,,1], ord$z.samples[,,2], type = 'points') UncertainOrd::CredibleViz(ord$z.samples[,,1], ord$z.samples[,,2], type = 'scatter', items = c(1,10,16)) UncertainOrd::CredibleViz(ord$z.samples[,,1], ord$z.samples[,,2], type = 'circles', items = c(1,10,16)) UncertainOrd::CredibleViz(ord$z.samples[,,1], ord$z.samples[,,2], type = 'density', items = c(1,10,16))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.