I have a big data frame like this
> dim(data1)
[1] 474303 128
> head(data1[1:2,1:6])
Tumor_Sample_Barcode Chromosome Position
1: A1 chr1 15772155
2: A1 chr1 16054813
End_Position Reference_Allele Tumor_Seq_Allele2
1: 15772155 G A
2: 16054813 G A
>
I have another dataframe like this
Chrom Position Ref Alt VAF
chr1 2716062 C A 0.323
chr1 3095112 T G 0.365
chr1 3342771 C G 0.123
chr1 3526376 C T 0.365
chr1 4121415 T G 0.225
chr1 4215706 G A 0.125
chr1 4304014 T G 0.286
chr1 4304016 A C 0.302
chr1 4388809 A C 0.135
I want to create another column named i_TumorVAF_WU in my big data frame in which VAF column comes from small data frame. Please notice that VAF values should be matched with Position in big data because small data coming from big data
Can you help please?
> unique(merge(data1,data,x.by=data1$Position,y.by=data$Position))
Returns a weird output with losing a big part of big data frame. I just want to add corresponding VAF values to the big data by keeping all the information in big data file