I would like to subset part of a large pairwise matrix into smaller matrices. e.g.
TF1 TF2 TF3 TG1 TG2 TG3
TF1 0 2 1 450 460 450
TF2 2 0 1 452 462 462
TF3 1 2 0 451 461 451
TG1 450 452 450 0 2 0
TG2 460 462 462 2 0 1
TG3 450 452 451 1 2 0
I can subset if I input the exact column and row name "TF1" etc but I want e.g. all of the TFs.
I reckon it may be a grep but I cant put grep anywhere in my forumula:
TF <-T_PW[c("TF1","TF2","TF3"),c("TF1","TF2","TF3")]
This is the expected output matrix:
TF2 TF3 TF1
TF1 0 2 1
TF2 2 0 1
TF3 1 2 0
Is it because since it is a pairwise then the columns and rows have names??
Thank you