Splitting characters of a column in repeated lines and reducing them to one line
OK. This is a bit convoluted, but it works. There might be simpler solutions...

First we'll write a function that takes a data frame and a character position (ie; first or second position in the string), groups the data frame by the second and third columns, counts occurrences of each character in the specified position of the 18th column, and returns a vector according to your ranking scheme (this doesn't include counts of N since it doesn't occur in your example data, but it's a simple extension of the case_when line to add it):

library(dplyr)
library(tidyr)
library(stringr)

summarise_characters &lt;- function(df, pos) {
  df %&gt;% mutate(character=str_sub(X18, pos, pos)) %&gt;% 
  group_by(X2, X3, character) %&gt;% 
  summarise(n=n()) %&gt;% 
  ungroup() %&gt;% 
  spread(character, n, fill=0) %&gt;% 
  mutate(pos1=case_when(`@` &gt; ß ~ '@', 
                        `@` == ß ~ 'N', 
                        `@` &lt; ß ~ 'ß')) %&gt;%
  `$`(pos1)
}


Next we remove duplicate lines from the data frame, then create a new column, pasting together the output of our function called on the first and second character:

df %&gt;% group_by(X2, X3) %&gt;%  
  slice(1) %&gt;%
  ungroup() %&gt;%
  mutate(counts=paste0(summarise_characters(df, 1), summarise_characters(df, 2))) %&gt;% 
  select(X1, X2, X3, X4, X11, X12, X13, counts)

# A tibble: 3 x 8
     X1        X2        X3                   X4       X11                  X12       X13 counts
  &lt;int&gt;     &lt;int&gt;     &lt;int&gt;                &lt;chr&gt;     &lt;int&gt;                &lt;chr&gt;     &lt;int&gt;  &lt;chr&gt;
1     1  90042011  90042031 AGTGCCACCAGGTGGGGCCG  90184354 GAGGCCACAAGAGGGCACAA  90184337     @N
2     1  94853396  94853416 GCCGCCACTAGATGGTGCTA  94969274 CAGTCCTCTAGAGGGAGCCC  94969266     ß@
3     2 103584283 103584303 TGGGCCACTAGGAGGCACTG 103841456 CATGCCACAAGAGGGCATCA 103841456     NN