treesplits: A function to detect break points of species occurance in...

Description Usage Arguments Value Author(s) Examples

View source: R/treesplits.R

Description

This is a function of the package "cooccurExtra". The main idea of this function is detecting break points of species occurance in different ingradients with the information of species and ingradients from different regions. It provides two kinds of plots to show the breaks points in different ingradients of each specie. Also it provides an output of break points (splits) of each ingradient and for each specie.

Usage

1
2
treesplits = function(mydata, species, ingradients, plot_title = TRUE, first_split = FALSE,
                      show.plots = c("both", "splits", "dendrogram", "none"))

Arguments

mydata

A data frame, which contains species and ingradients information from different regions.

species

A list of charaters with names of the needed species.

ingradients

A list of charaters with names of the needed ingradients where to be deteted break points.

plot_title

A logical value, which indicates showing plots with or without title.

first_split

A logical value, which indicates showing scatter plots with only the first split or showing all the splits. By default, first_split = FALSE, which means only the first splits will be shown.

show.plots

A choice of the showing plots. (show.plots = "splits") shows only the break points in the scatter plots. (show.plots = "dendrgram") shows only the tree dendrograms from the "rpart" models. (show.plots = "none") if no plot is needed. The default is (show.plots = "both"), which shows both the splits plots and the dendrograms.

Value

Returns a list of break points in different ingradients and for different species.

Author(s)

Yingjia Jot He

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  # create a vector of charaters with all the needed species' names
  Ten.Needed <- c("alpheus", "theora.lubrica", "aricidea",
                 "paradonidae.other", "austrovenus.stutchburyi", "macomona.liliana",
                 "maldanidae", "aonides", "prionospio.aucklandica", "orbiniidae")

  # create a vector of charaters with all the needed ingradients' names
  Ing.Needed <- c("Log.mud.1.", "SST")

  # ask for the data frame to be analized
  data(macrofauna)

  # the default with two kinds of plots
  mytest <- treesplits(macrofauna, species = Ten.Needed, ingradients = Ing.Needed)

  # show the output
  mytest

  # case with one specie that does not exist and show only the splits plots
  mytest <- treesplits(macrofauna, species = c(Ten.Needed, "fake.specie"),
                      ingradients = Ing.Needed, show.plots = "splits")

  # case with one ingradient that does not exist and show only the dendrograms
  mytest <- treesplits(macrofauna, species = Ten.Needed,
                      ingradients = c(Ing.Needed, "fake.specie"),
                      show.plots = "dendrogram")

JotSoSerious/cooccurExtra documentation built on Oct. 30, 2019, 8:03 p.m.