ar1 <- array(data = c(1:16), dim = c(4,4))
ar2 <- array(data = c(1:16), dim = c(4,4))
colnames(ar1) <- c("A","B","D","E")
colnames(ar2) <- c("C","A","E","B")
# get the common names between the matrices
same <- intersect(colnames(ar1), colnames(ar2))
# join them together
rbind(ar1[,same], ar2[,same])
"A big computer, a complex algorithm and a long time does not equal science." -- Robert Gentleman
Visualizzazione post con etichetta intersection. Mostra tutti i post
Visualizzazione post con etichetta intersection. Mostra tutti i post
venerdì 20 aprile 2007
How to join two arrays using their column names intersection
Iscriviti a:
Commenti (Atom)