I'm new on R, so apologies in advance. I have a data.frame (df_final_a) with 800+ columns and 16.000+ rows. It looks like this:
**chrom gene mutation patient1 patient2 patient3**
chr1 abc xxx ./. 0/1 ./.
chr1 def yxx 1/1 ./. 0/1
chr2 ghi yyx 0/1 ./. ./.
chr2 lmn yyy ./. 1/1 ./.
./. = this means that the patient doesn't have that mutation.
0/1 and other numbers mean that the patient has a certain type of that mutation
From this data frame I want to have two other tables:
dfA:
**patient mutation**
patient1 yxx(1/1), yyx(0/1)
patient2 xxx(0/1), yyy(1/1)
patient3 yxx(0/1)
dfB:
**patient chrom gene mutation**
patient2 chr1 abc xxx
patient1, patient3 chr1 def yxx
patient1 chr2 ghi yyx
patient2 chr2 lmn yyy
thank you for any suggestion you can give me