NNGraphParam-class {bluster} | R Documentation |
Run community detection algorithms on a nearest-neighbor (NN) graph within clusterRows
.
NNGraphParam( shared = TRUE, ..., cluster.fun = "walktrap", cluster.args = list() ) ## S4 method for signature 'ANY,NNGraphParam' clusterRows(x, BLUSPARAM, full = FALSE)
shared |
Logical scalar indicating whether a shared NN graph should be constructed. |
... |
Further arguments to pass to |
cluster.fun |
Function specifying the method to use to detect communities in the NN graph. The first argument of this function should be the NN graph and the return value should be a communities object. Alternatively, this may be a string containing the suffix of any igraph community detection algorithm.
For example, |
cluster.args |
Further arguments to pass to the chosen |
x |
A numeric matrix-like object where rows represent observations and columns represent variables. |
BLUSPARAM |
A NNGraphParam object. |
full |
Logical scalar indicating whether the graph-based clustering objects should be returned. |
To modify an existing NNGraphParam object x
,
users can simply call x[[i]]
or x[[i]] <- value
where i
is any argument used in the constructor.
The NNGraphParam
constructor will return a NNGraphParam object with the specified parameters.
The clusterRows
method will return a factor of length equal to nrow(x)
containing the cluster assignments.
If full=TRUE
, a list is returned with clusters
(the factor, as above) and objects
;
the latter is a list with graph
(the graph) and communities
(the output of cluster.fun
).
Aaron Lun
makeSNNGraph
and related functions, to build the graph.
cluster_walktrap
and related functions, to perform community detection.
clusterRows(iris[,1:4], NNGraphParam()) clusterRows(iris[,1:4], NNGraphParam(k=5)) clusterRows(iris[,1:4], NNGraphParam(cluster.fun="louvain"))