Sum of rows for GSEA analysis
Hi,
I have an issue which looks like easy to solve, but I’m stuck. I have a dataframe composed of columns (significant pathways retrieved from GSEA) and rows (entrez gene ids). In this data frame there are 1 if a gene is present in a pathway or 0 when not. This is my data frame:
Path_A Path_B Path_C
Gene_1 0 1 0
Gene_2 1 1 0
Gene_3 0 0 1
Gene_4 1 1 1
I want to sum the rows (genes) to calculate how many times a gene is present in distinct pathways, and thus get something like this:
Path_A Path_B Path_C
Gene_1 0 1 0
Gene_2 2 2 0
Gene_3 0 0 1
Gene_4 3 3 3
I have figured out that uising rowsum()
might solve my issue. However, when checking R documentation for the function I had some troubles and I couldn’t retrieve my desired output.
Is there any way to perform this sum?
Thanks in advance!
• 28 views
Read more here: Source link