  The Gaia DR2 radial velocity sample (GDR2RVS), which provides six-dimensional
phase-space information on 7.2 million stars, is of great value for inferring
properties of the Milky Way. Yet a quantitative and accurate modelling of this
sample is hindered without knowledge and inclusion of a well-characterized
selection function. Here we derive the selection function through estimates of
the internal completeness, i.e. the ratio of GDR2RVS sources compared to all
Gaia DR2 sources (GDR2all). We show that this selection function or
"completeness" depends on basic observables, in particular the apparent
magnitude GRVS and colour G-GRP, but also on the surrounding source density and
on sky position, where the completeness exhibits distinct small-scale
structure. We identify a region of magnitude and colour that has high
completeness, providing an approximate but simple way of implementing the
selection function. For a more rigorous and detailed description we provide
python code to query our selection function, as well as tools and ADQL queries
that produce custom selection functions with additional quality cuts.
