View source: R/estimator_registry.R
| register_estimator | R Documentation |
Register a custom or built-in network estimator function by name.
Estimators registered here can be used by estimate_network
via the method parameter.
register_estimator(name, fn, description, directed)
name |
Character. Unique name for the estimator (e.g. |
fn |
Function. The estimator function. Must accept |
description |
Character. Short description of the estimator. |
directed |
Logical. Whether the estimator produces directed networks. |
Invisible NULL.
get_estimator, list_estimators,
remove_estimator, estimate_network
my_fn <- function(data, ...) {
m <- cor(data)
diag(m) <- 0
list(matrix = m, nodes = colnames(m), directed = FALSE)
}
register_estimator("my_cor", my_fn, "Custom correlation", directed = FALSE)
df <- data.frame(A = rnorm(20), B = rnorm(20), C = rnorm(20))
net <- build_network(df, method = "my_cor")
remove_estimator("my_cor")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.