ReplaceNamesUsingOToL:

Usage Arguments Examples

Usage

1
ReplaceNamesUsingOToL(phy, verbose = TRUE)

Arguments

phy
verbose

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (phy, verbose = TRUE) 
{
    names.start <- phy$tip.label
    names.end <- rep(NA, length(names.start))
    for (i in sequence(length(names.start))) {
        result <- NA
        try(result <- tnrs_match_names(names.start[i]))
        if (!is.na(result[1])) {
            names.end[i] <- result$unique_name[1]
        }
        if (i%%25 == 0 & verbose) {
            print(paste("done ", i/length(names.start)))
        }
    }
    phy$tip.label[which(!is.na(names.end))] <- names.end[which(!is.na(names.end))]
    phy <- drop.tip(phy, names.start[which(is.na(names.end))])
    return(phy)
  }

bomeara/prepotol documentation built on May 12, 2019, 11:36 p.m.