letter_string_to_binary: Convert ranges in the form of letters (A, AB, BFG, etc.) to...

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/BioGeoBEARS_basics_v1.R

Description

This function takes a letter string (e.g. ABD) and converts to binary encoding (e.g. 1101).

Usage

1
2
  letter_string_to_binary(letter_string,
    letter_codes_in_desired_order = "alphabet")

Arguments

letter_string

A string of letters (e.g. "ABD")

letter_codes_in_desired_order

The letter codes in the desired order. The default keyword, "alphabet", uses the standard 26 capital letters; the output binary codes will thus have 26 positions. If the user inputs fewer letters here, or puts them in another order, those will be used.

Value

numcodes A list with the binary codes.

Note

Go BEARS!

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

http://phylo.wikidot.com/matzke-2013-international-biogeography-society-poster

Matzke_2012_IBS

See Also

binary_ranges_to_letter_codes, binary_range_to_letter_code_list, letter_strings_to_tipranges_df

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
testval=1
letter_string = "ABD"
letter_string_to_binary(letter_string, letter_codes_in_desired_order="alphabet")

letter_string = "ABD"
letter_string_to_binary(letter_string,
letter_codes_in_desired_order=c("A","B","C","D","E","F"))

letter_string = "ABD"
letter_string_to_binary(letter_string,
letter_codes_in_desired_order=strsplit("ABCDEF", split="")[[1]])

BioGeoBEARS documentation built on May 29, 2017, 8:36 p.m.