ChooseRef

Functions for the Durbecq et al. paper (in prep) about ecosystem references

How to install the package?

If not yet installed, you should install devtools:

install.packages(devtools)

Load `devtools:

library(devtools) 

Install package ChoosRef:

install_github("RenaudJau/ChooseRef")

And load it:

library(ChooseRef)

How to use the functions?

Here is an example with the dune dataset from vegan package :

library(vegan)
data("dune") #downloading of dune data (cf vegan)
data("dune.env") #downloading of dune.env data (cf vegan)
# keeping only the numeric variables :
dune.env <- data.frame(A1 = dune.env$A1, 
                       Moisture =  as.numeric(as.vector(dune.env$Moisture)),
                       Manure = as.numeric(as.vector(dune.env$Manure)))

# Creating a vector indicating which plots are the potential references and which ones are the restored sites
sites <- factor(c(rep("Rest",5),rep("Ref",15)))
# Creating a vector with the plot names
sites_names <- paste(sites,c(1:5,1:15))
#Poviding names to rows (useful for the outputs)
row.names(dune.env) <- sites_names
row.names(dune) <- sites_names
dune.envRest <- dune.env[sites=="Rest",]
dune.envRef <- dune.env[sites=="Ref",]

So your data.frame should look something like:

library(knitr)
data.frame(dune.envRest)
data.frame(dune.envRef)

Calculating reference dissimilarities

Distances <- DissRef3(RELEVES = dune.envRest, REF = dune.envRef, METHOD = "euclidean", DUPLICATES = FALSE)
Distances

Plotting reference dissimilarities

Diss_Ref_Plot(RELEVES = dune.envRest, REF = dune.envRef, DISTANCES = Distances, LINK_NUMBER = "N_REF", N_REF = 3)


RenaudJau/ChooseRef documentation built on April 20, 2020, 10:45 p.m.