Displaying 1 result from an estimated 1 matches for "kreissaa".
2011 Jun 07
1
assign a cluster based on a variable
Hi,
I have two matrices of the following form:
cluster (n=18):
12062 1
12063 2
12064 2
12065 3
12066 5
KreisSA (n=2304)
12062
12062
12067
12065
12063
12067
I try to assign the cluster[,2] to KreisSAa by the follwoing loop:
n <- nrow(cluster)
KreisSAa <- numeric()
for(i in 1:n){
KreisSAa[KreisSA == cluster[i,1]] <- cluster[i,2]
}
The result is a vector of the length n=4608 where after the entry 2304
are just NA's
Has someone an idea what I do wrong?
Thanks for your help.
Domi...