Skip to content

Extraction of columns from two matrices

3 messages · nisha chandran, Dennis Murphy

#
Hi:

Is this what you have in mind?

m1 <- matrix(rpois(100, 10), nrow = 10, dimnames = list(NULL,
paste('V', 1:10, sep = '')))
m2 <- matrix(rpois(40, 10), nrow = 10, dimnames = list(NULL,
paste('V', c(2, 5, 7, 10), sep = '')))
colnames(m1)
colnames(m2)

m1[, colnames(m2)]

HTH,
Dennis

On Wed, May 4, 2011 at 11:10 PM, nisha chandran
<slamdunkangel666 at gmail.com> wrote: