meanInRegions
The meanInRegions function is useful when we want to evaluate the relation of a RS against some sort of numeric value. For example, we could test whether the methylation levels of our RS is higher than expected, or if it accumulates fewer mutation than one would expect.
I am not sure how to use it to evaluate if RS accumulates fewer mutations than one would expect?
I have set of regions A and genome-wide set of SNVs S. Ideally I would like to check if my regions have on average more/less SNPs (higher/lower SNP density).
I would recommend using mean in regions if you have precomputed levels of some magnitude per base or per genomic windows. An example of that could be the density of SNPs per megabase in a population level or the methylation values per CpG site determined by a Methylation array.
On the other hand, if you do not have the variant density values but the actual variants, I would recommend using numOverlaps and actually count the number of variants falling in your regions.
Take into account that if you want to test the association with variants you called, you'll need to make sure that the randomized regions do not fall into parts of the genome where no variants can be called (centromeres, unmappable regions...) using a suitable mask.