Description Usage Arguments Details Value Author(s) See Also Examples
Given a list of areas (actually a list of anything; all that is important is the length of the list)
rcpp_areas_list_to_states_list
calculates all possible combinations of these areas,
listing them by the 0-based indices that specify the position of each area in the list.
1 2 | rcpp_areas_list_to_states_list(areas = c("A", "B", "C"),
maxareas = length(areas), include_null_range = TRUE)
|
areas |
a list of areas (character or number; the function converts these to numbers, starting with 0) |
maxareas |
maximum number of areas in this analyses |
include_null_range |
|
Using 0-based indexing is convenient in the C++ code called by the other functions, rather than having to keep track of the various people might label their areas (names, abbreviations, letters, numbers).
As in LAGRANGE (Ree & Smith 2008), the maximum range size (i.e. the maximum number of areas in a range) can be specified by the user. Having a smaller maximum range size drastically reduces the number of states, and thus the size of the transition matrix and the cladogenesis matrix.
R_states_list
A list of the states, where each state is a list of areas in the form of 0-based indices
Nicholas Matzke matzke@berkeley.edu
numstates_from_numareas
, areas_list_to_states_list_old
#bibliography /Dropbox/_njm/__packages/cladoRcpp_setup/cladoRcpp_refs.bib
@cite Matzke_2013
@cite Matzke_2014
@cite ReeSmith2008
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 26 27 28 29 | # Specify the areas
areas_list = c("A", "B", "C")
areas_list
# Let's try Rcpp_combn_zerostart, in case that is the source of a
# problem found via AddressSanitizer
Rcpp_combn_zerostart(n_to_choose_from=4, k_to_choose=2, maxlim=1e+07)
Rcpp_combn_zerostart(n_to_choose_from=4, k_to_choose=3, maxlim=1e+07)
## Not run:
# Calculate the list of 0-based indices for each possible geographic range, i.e.
# each combination of areas
states_list = rcpp_areas_list_to_states_list(areas=areas_list, maxareas=3,
include_null_range=FALSE)
states_list
states_list = rcpp_areas_list_to_states_list(areas=areas_list, maxareas=3,
include_null_range=TRUE)
states_list
states_list = rcpp_areas_list_to_states_list(areas=areas_list, maxareas=2,
include_null_range=TRUE)
states_list
states_list = rcpp_areas_list_to_states_list(areas=areas_list, maxareas=1,
include_null_range=TRUE)
states_list
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.