| sumstat_class | R Documentation |
Base Class for Summary Statistics
Base Class for Summary Statistics
If you want to create additional summary statistics for coala, create R6 classes that inherit from this object.
coala::coalmodelpart -> sumstat
new()Initialization of $sumstat
sumstat_class$new(name, transformation)
namethe name to be used for this statistic
transformationtransformation to be used for this statistic
NULL
calculate()This function must be overwritten in the derived class
sumstat_class$calculate(seg_sites, trees, files, model)
seg_sitesseg_sites object containing the segregating sites
treestrees
filesfiles
modeldemographic model
NULL
check()Optional functions that checks if a model is compatible with the stat.
In a derived class this can be overwritten by a function that throws an informative error if the model is incompatible with the statistic The function is executed before the statistic is added to the model.
sumstat_class$check(model)
modeldemographic model
invisible TRUE
get_name()function to read the private attribute name
sumstat_class$get_name()
name of the statistic
requires_files()function to check whether files are required by this statsitic
sumstat_class$requires_files()
req_files, which is TRUE or FALSE and indicates whether files are required by this statsitic
requires_segsites()function to check whether segregating sites are required by this statsitic
sumstat_class$requires_segsites()
req_segsites, which is TRUE or FALSE and indicates whether segregating sites are required by this statsiti
requires_trees()function to check whether trees are required by this statsitic
sumstat_class$requires_trees()
req_trees, which is TRUE or FALSE and indicates whether trees are required by this statsitic
print()function to print the class of the statistic
sumstat_class$print()
transform()Transformation that is applied to the statistic
sumstat_class$transform(x)
xuntransformed value
transformed value
clone()The objects of this class are cloneable with this method.
sumstat_class$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.