My data is contained in a data.frame:
SYMBOL variable value Sample IDs Group TLR8 MMRF_2613_1_BM 3.186233 Baseline 2613 LessUp TLR8 MMRF_2613_1_BM 5.471014 Baseline 2613 LessUp TLR8 MMRF_2613_1_BM 2.917965 Baseline 2613 MostUp TLR8 MMRF_2613_1_BM 2.147028 Baseline 2613 MostUp TLR4 MMRF_2613_1_BM 7.497424 Baseline 2613 LessUp TLR4 MMRF_2613_1_BM 4.16523 Baseline 2613 LessUp TLR4 MMRF_2613_1_BM 7.136523 Baseline 2613 MostUp TLR4 MMRF_2613_1_BM 7.96523 Baseline 2613 MostUp For each SYMBOL, I would like to divide the sum of value for the rows where Group is "MostUp" by the sum of value for "LessUp" rows.
I believe I could use the group_by function, but I am not sure how to apply it correctly.
Here is an example of my expected output.
SYMBOL variable value Sample IDs Group TLR8 MMRF_2613_1_BM 0.58 Baseline 2613 MostUp_divided_by_LessUp TLR4 MMRF_2613_1_BM 1.29 Baseline 2613 MostUp_divided_by_LessUp In addition to calculating the ratios, how would I perform a T-test between the groups?
0.58and1.29asvalue? Do you divide them individually then take mean or sum them and divide?