View source: R/add_bias_to_traits.R
add_bias_to_traits | R Documentation |
Add small amount of bias to traits to avoid taxa having the same traits.
add_bias_to_traits(x, fuzzy = TRUE, col_blocks = NULL, SD = 0.001)
x |
Result of |
fuzzy |
Are you working with fuzzy traits? Default to |
col_blocks |
A vector that contains the number of modalities for each trait. |
SD |
The amount of bias. |
This function works by adding a small amount of bias to traits.
The bias is added with the stats::rnorm()
function.
Fuzzy data are prepared with the function ade4::prep.fuzzy()
of the ade4
package.
This function works with positive numeric traits.
data(macro_ex)
data_bio <- as_biomonitor(macro_ex)
data_agr <- aggregate_taxa(data_bio)
data_ts <- assign_traits(data_agr)
data_ts_av <- average_traits(data_ts)
data_ts_av[1:5, 1:5]
# set col_blocks
col_blocks <- c(8, 7, 3, 9, 4, 3, 6, 2, 5, 3, 9, 8, 8, 5, 7, 5, 4, 4, 2, 3, 8)
add_bias_to_traits(data_ts_av, fuzzy = TRUE, col_blocks = col_blocks)[1:5, 1:5]
add_bias_to_traits(data_ts_av, fuzzy = TRUE, col_blocks = col_blocks, SD = 0.01)[1:5, 1:5]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.