Adding new columns to this data frame I have a dataframe like this

&gt; dim(anno_maf)
[1] 32786   129
&gt; head(anno_maf[1:2,1:4])
   Tumor_Sample_Barcode Chromosome Start_Position
1:                    a       chr1       27105930
2:                    a       chr1        3342771
   End_Position
1:     27105930
2:      3342771
&gt; 


I have a list of genes like

gene name
PTEN
PTEN
MAP3K1
MALAT1
MED12
RUNX1
PIK3CA
FBXW7
ARID1A
MED12
TAB1


I want to add a column in my dataframe named COSMIC, if a gene in gene list exists in my dataframe Hugo_Symbol column, put a yes for this gene if not put a no; Finally my data frame has an extra column as COSMIC in which I have yes or no in Hugo_Symbol column based on the existence of genes in my gene list

Can you help me please?

Thank you
You can use ifelse():

anno_maf$COSMIC &lt;- ifelse(anno_maf$Hugo_Symbol %in% your_gene_list,
                          yes = "yes",
                          no = "no")