Defines the island_tbl class which is used when extracting information from the phylogenetic and island data to be used for constructing a daisie_data_tbl
Defines the island_tbl class which is used when extracting information from the phylogenetic and island data to be used for constructing a daisie_data_tbl
Adds a specified number of missing species to an existing island_tbl at the colonist specified by the species_to_add_to argument given. The species given is located within the island_tbl data and missing species are assigned. This is to be used after extract_island_species() to input missing species.
Calculates the number of missing species to be assigned to each island clade in the island_tbl object and assigns the missing species to them. In the case that multiple genera are in an island clade and each have missing species the number of missing species is summed. Currently the missing species are assigned to the genus that first matches with the missing species table, however a more biologically or stochastic assignment is in development.
Detects any cases where a non-endemic species or species not present on the island has likely been on the island given its ancestral state reconstruction indicating ancestral presence on the island and so is likely a back colonisation from the island to the mainland (or potentially different island). This function is useful if using extraction_method = "min" in DAISIEprep::extract_island_species() as it may brake up a single colonist into multiple colonists because of back-colonisation.
Checks whether the phylogeny has an outgroup that is not present on the island. This is critical when extracting data from the phylogeny so the stem age (colonisation time) is correct.
Checks whether there are any species in the phylogeny that have multiple tips (i.e. multiple subspecies per species) and whether any of those tips are paraphyletic (i.e. are their subspecies more distantly related to each other than to other subspecies or species).
Converts the Island_tbl class to a data frame in the format of a DAISIE data table (see DAISIE R package for details). This can then be input into DAISIEprep::create_daisie_data() function which creates the list input into the DAISIE ML models.
Performance analysis of the extract_island_species() function Uses system.time() for timing for reasons explained here: https://radfordneal.wordpress.com/2014/02/02/inaccurate-results-from-microbenchmark/ # nolint
Checks whether \linkS4class{phylo4d} object conforms to the requirements of the DAISIEprep package. If the function does not return anything the data is ready to be used, if an error is returned the data requires some pre-processing before DAISIEprep can be used
Reads in the checklist of all species on an island, including those that are not in the phylogeny (represented by NA) and counts the number of species missing from the phylogeny each genus
This is a wrapper function for DAISIE::DAISIE_dataprep(). It allows the final DAISIE data structure to be produced from within DAISIEprep. For detailed documentation see the help documentation in the DAISIE package (?DAISIE::DAISIE_dataprep).
Creates a data frame with the endemicity status (either 'endemic', 'nonendemic', 'not_present') of every species in the phylogeny using a phylogeny and a data frame of the island species and their endemicity (either 'endemic' or 'nonendemic') provided.
Extracts an island clade based on the ancestral state reconstruction of the species presence on the island, therefore this clade can contain non-endemic species as well as endemic species.
Creates a name for a clade depending on whether all the species of the clade have the same genus name or whether the clade is composed of multiple genera, in which case it will create a unique clade name by concatinating the genus names
Extracts the information for an endemic clade (i.e. more than one species on the island more closely related to each other than other mainland species) from a phylogeny (specifically phylo4d object from phylobase package) and stores it in an Island_colonist class
Extracts the information for an endemic species from a phylogeny (specifically phylo4d object from phylobase package) and stores it in in an Island_colonist class
Extracts the information for a species (endemic or non-endemic) which has multiple tips in the phylogeny (i.e. more than one sample per species) from a phylogeny (specifically phylo4d object from phylobase package) and stores it in an Island_colonist class
Extracts the information for a non-endemic species from a phylogeny (specifically phylo4d object from phylobase package) and stores it in in an island_colonist class
Extracts the colonisation, diversification, and endemicty data from phylogenetic and endemicity data and stores it in an Island_tbl object using the "asr" algorithm that extract island species given their ancestral states of either island presence or absence.
Extracts the colonisation, diversification, and endemicty data from phylogenetic and endemicity data and stores it in an Island_tbl object using the "min" algorithm that extract island species as the shortest time to the present.
Extracts the stem age from the phylogeny when the a species is known to belong to a genus but is not itself in the phylogeny and there are members of the same genus are in the phylogeny. The stem age can either be for the genus (or several genera) in the tree (stem = "genus") or use an extraction algorithm to find the stem of when the species colonised the island (stem = "island_presence), either 'min' or 'asr' as in extract_island_species(). When stem = "island_presence" the reconstructed node states are used to determine the stem age.
Extracts the stem age from the phylogeny when the a species is known to belong to a genus but is not itself in the phylogeny and there are members of the same genus are in the phylogeny using the 'asr' extraction method
Extracts the stem age from the phylogeny when the a species is known to belong to a genus but is not itself in the phylogeny and there are members of the same genus are in the phylogeny
Extracts the stem age from the phylogeny when the a species is known to belong to a genus but is not itself in the phylogeny and there are members of the same genus are in the phylogeny using the 'min' extraction method
Determines if colonist has already been stored in Island_tbl class. This is used to stop endemic clades from being stored multiple times in the island table by checking if the endemicity status and branching times are identical.
Checks whether two Island_tbl objects are identical. If they are different comparisons are made to report which components of the Island_tbls are different.
Extracts the colonisation, diversification, and endemicty data from multiple phylod (phylo4d class from phylobase) objects (composed of phylogenetic and endemicity data) and stores each in an Island_tbl object which are stored in a Multi_island_tbl object.
Loops through the genera that have missing species and removes the ones that are found in the missing genus list which have phylogenetic data. This is useful when wanting to know which missing species have not been assigned to the island_tbl using add_multi_missing_species().
Takes a string of the various ways the island species status can be and returns a uniform all lower-case string of the same status to make handling statuses easier in other function
Determines the unique endemic genera that are included in the island clades contained within the island_tbl object and stores them as a list with each genus only occuring once in the first island clade it appears in