I have a data frame with 192 columns. I want to make a 96 column data frame by subtracting matching column based in pairing. The pairing info is found in the data frame Pairing
in the column Match
. The column Pos
matches as substring the column names of my data frame that I want to subtract.
How do I use the pairing info in Pairing
to identify which column to subtract.
> Pairing
Match Pos
Control_70 001_A01
Control_56 001_A02
Case_70 001_A03
Case_56 001_A04
Control_21 001_A05
Case_21 001_A06
> head(matures.cpm.spike.batch[,1:6])
001_A01_S1 001_A02_S2 001_A03_S3 001_A04_S4 001_A05_S5 001_A06_S6
hsa-let-7a-5p 16.566813 11.415796 12.400252 22.701457 8.864882 20.442599
hsa-let-7b-5p 15.574190 11.107133 12.196465 17.954547 8.527478 25.788286
hsa-let-7c-5p 5.976763 4.372978 5.984685 9.821348 6.341252 7.480211
hsa-let-7d-3p 16.508818 10.697730 11.001534 18.375286 7.583910 24.974774
hsa-let-7d-5p 13.273824 5.134547 9.456675 11.567230 7.096485 13.294108
hsa-let-7f-5p 13.900711 9.804384 11.481614 20.002110 7.878241 17.295909