ourMELONS/R/clusternum.R
Waldir Leoncio fca9caa731 Restyled files
Ran through styler::style_dir() in the R and tests directories in preparation for #23.
2021-11-10 14:25:50 +01:00

14 lines
321 B
R

clusternum <- function(X, T, k, c) {
m <- size(X, 1) + 1
while (!isempty(k)) {
# Get the children of nodes at this level
children <- X[k, 1:2]
# Assign this node number to leaf children
t <- (children <= m)
T[children[t]] <- c
# Move to next level
k <- children[!t] - m
}
return(T)
}