I have a data table in R which I want to count the number of overlapping windows for. This is essentially a pileup command and seems to be something that could be done using bedtools, but I can't figure out how to do so without leaving R.
Is there an R function to do this already, or any suggestions about what may be an efficient approach?
In case it's helpful, here is a mini example of what I'm trying to do. Thanks in advance!
input:
chrom start end
1 1 100
1 50 150
returns:
chrom start end count
1 1 49 1
1 50 100 2
1 101 150 1