I am not sure how to make this work?
I wish to make a new column in a dataframe dependent on whether or not two other columns meet the following criteria:
if df$Cn_LCIS and df$Cn_ILC are both greater than '2' print '0'
if df$CN_LCIS and df$Cn_ILC are both smaller than '2' print '0'
and if they are the same also print '0' else print '1'
df
Chromosome Start End Cn_ILC mCn_ILC Cn_LCIS mCn_LCIS both
chr1.1 chr1 0 11194349 2 1 2 1 0
chr1.2 chr1 102809740 104579163 2 1 3 1 1
chr1.3 chr1 104579163 121311799 2 1 2 1 0
chr1.4 chr1 11194349 11492125 2 1 3 1 1
chr1.5 chr1 11492125 71442329 2 1 2 1 0
chr1.6 chr1 144009053 157140292 1 1 1 1 0
chr1.7 chr1 157140292 243709339 2 1 1 1 0
chr1.8 chr1 243709339 244112662 3 1 3 1 0
chr1.9 chr1 244112662 249250621 3 1 3 1 0
chr1.10 chr1 71442329 72624878 2 1 3 1 1
chr1.11 chr1 72624878 102809740 2 1 4 1 1
Not working:
df$both <- ifelse(df$Cn_LCIS > 2 & df$Cn_ILC > 2, 0, ifelse (df$Cn_LCIS < 2 & df$Cn_ILC < 2, 0, ifelse (df$Cn_LCIS == 2 & df$Cn_LCIS == 2, 0, ifelse(df$Cn_ILC!=df$Cn_LCIS,1))))