I have downloaded two datasets, and I am trying to remove the genes they do not share in common. Is there a biocmanager package with a function that can compare their gene ids, match them and reorder them?
Assuming the datasets are arranged in matrices with one gene per row, this can be done by intersecting row names:
commonNames <- sort(intersect(rownames(data1.mat), rownames(data2.mat))); filtered.data1.mat <- data1.mat[commonNames,]; filtered.data2.mat <- data2.mat[commonNames,];
It would be helpful if you could provide more information about your datasets. There are many other ways to do this, and the way that works best for you will depend on your particular situation.