ourMELONS/R/clusternum.R
Waldir Leoncio 4520fd30fb Fixed syntax
2021-05-20 09:18:05 +02:00

14 lines
No EOL
302 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)
}