How to document S4 methods for an existing generic?

How do I document S4 methods with roxygen2, say for the [ operator (i.e., for an existing generic from another package)?

For a concrete example, take this answer from SO:

How to document that S4 method with roxygen2?

Many thanks in advance!

Take a look at R packages book for this type of question:

Thank you for the pointer, I did already. Also looked in new coming book: But I still do not know how to do it.

Did you try the suggestion in this thread?

Thank you Mara, I had seen that thread and also this one: r - How to properly document S4 methods using roxygen2 - Stack Overflow

but I had (hastily) overlooked them because those answers have some years already, and also because I of Hadley's comment in that thread above:

Would you mind updating this for roxygen2 3.0? None of these workarounds should be necessary any more. – hadley Jan 21 '14 at 12:54

But I will give it a try! Thanks again!

I tried several combinations of the solutions given in those threads but to no avail.

Maybe you may help if I share an example. I want to document the methods for [ operation generic. So my question is: what should be the roxygen2 tags for these 3 methods?

#' @export
          signature(x = "studies", i = "missing", j = "missing", drop = "missing"),
          definition = function(x) x)

#' @export
          signature(x = "studies", i = "numeric", j = "missing", drop = "missing"),
          definition = function(x, i) {
            study_ids <- unique(x@studies$study_id)[i]
            filter_by_id(x, id = study_ids)

#' @export
          signature(x = "studies", i = "character", j = "missing", drop = "missing"),
          definition = function(x, i) {
            filter_by_id(x, id = i)

I tried several combinations of

#' @name
#' @aliases
#' @rdname

but I am always doing something wrong.

I think I got the gist of it!

Is there any way of prettifying these entries for the methods [ under section " Subset GWAS Catalog Entities":