Discussion:
[igraph] get network centralization via boot()
John Erwin Banez
2018-02-28 02:00:41 UTC
Permalink
How is it possible to input "centr_degree" in boot()?

My code so far is:



g1 <- sample_pa_age(5000, pa.exp=1, aging.exp=0, aging.bin=1000)
deg = boot(data=g1,* statistic=centr_degree,* R=5000)

but is getting:

Error in match.arg(arg = arg, choices = choices, several.ok = several.ok) :
'arg' must be of length 1

I also tried "defining" the function to be used in "statistic=":


cntr <- function (graph, mode = c("all", "out", "in", "total"), loops =
TRUE,
normalized = TRUE)
{
if (!is_igraph(graph)) {
stop("Not a graph object")
}
mode <- switch(igraph.match.arg(mode), out = 1, `in` = 2,
all = 3, total = 3)
loops <- as.logical(loops)
normalized <- as.logical(normalized)
on.exit(.Call(C_R_igraph_finalizer))
res <- .Call(C_R_igraph_centralization_degree, graph, mode,
loops, normalized)
res
}


cntr = boot(data=g1, statistic=cntr, R=5000)

BUT I get the following error:

Error in igraph.match.arg(mode) :
could not find function "igraph.match.arg"
--
John Erwin Bañez
Assistant Professor
College of Social Work and Community Development
University of the Philippines, Diliman
Loading...