Entering edit mode
Hi,
I have two different *.csv files with different column headers except one column, i.e, one with the gene symbols and expression data (samples), and the other with the gene symbols and phenotypic data/attributes, in both the files, one column (gene symbols) is same. I would like to merge both the files based on mapping with the gene symbol column and save all the data in one file for further data analysis. I would like to know how this could be done.
Thank you,
Toufiq
Please do not cross-post. https://www.biostars.org/p/397989/
You could read both files in and do a
match
on the two columns of gene symbols, do acbind
andwrite.csv
- That assumes the gene symbols are unique?. I think there is also amerge
function. But I would also highly recommend looking into the BioconductorSummarizedExperiment
class that is designed to store data of this type. Perhaps others have more sophisticated ways of achieve this or know of some existing function ... ?merge()
is meant to make these sorts of operations easier;dplyr::left_join()
is also very effectiveThank you so much for the suggestions.