I have a table with several columns and in one of them I need to create a loop that flows down the column and if the same number is present twice another column is created (adding a "p" for example) and in which are present only once in the same column created earlier is added for example "-". Anyone?
the column have Barcodes TCGA-3M-AB47-01A-22R-A414-31
I need the AB47
for(code in tabela$Barcode){
t=sapply(strsplit(as.character(code), "-"), function(x) x[[2]]) #to extract the AB47