  Recent observations of the long period comet C/2016 R2 (PanSTARRS) indicate
an unusually high N2/CO abundance ratio, typically larger than 0.05, and at
least 2-3 times higher than the one measured in 67P/Churyumov-Gerasimenko.
Another striking compositional feature of this comet is its heavy depletion in
H2O, compared to other comets. Here, we investigate the formation circumstances
of a generic comet whose composition reproduces these two key features. We
first envisage the possibility that this comet agglomerated from clathrates,
but we find that such a scenario does not explain the observed low water
abundance. We then alternatively investigate the possibility that the building
blocks of the comet C/2016 R2 (PanSTARRS) agglomerated from grains and pebbles
made of pure condensates via the use of a disk model describing the radial
transport of volatiles. We show that N2/CO ratios reproducing the value
estimated in this comet can be found in grains condensed in the vicinity of the
CO and N2 icelines. Moreover, high CO/H2O ratios (>100 times the initial gas
phase value) can be found in grains condensed in the vicinity of the CO
iceline. If the building blocks of a comet assembled from such grains, they
should present N2/CO and CO/H2O ratios consistent with the measurements made in
comet C/2016 R2 (PanSTARRS)'s coma. Our scenario indicates that comet C/2016 R2
(PanSTARRS) formed in a colder environment than the other comets that share
more usual compositions. Our model also explains the unusual composition of the
interstellar comet 2l/Borisov.
