r - S4 documentation of "[" with 'missing' arguments -
this question similar this question when try answer receive addition 'note' following r cmd check. although note have clean check.
* checking rd line widths ... note error: 8: no comma in argument list following \s4method execution halted i can rid of if pass other parameters (i,j,drop) , document of them don't use them. seems me waste add in documentation when isn't relevant in case.
#' s4 class stores list. #' @export setclass("testclass", representation(a="list")) #' extract parts of testclass. #' @param x testclass #' setmethod("[", signature(x = "testclass"), function (x){ print("void function") } ) the rd file resulting in error:
% generated roxygen2 (4.1.1): not edit hand % please edit documentation in r/test.r \doctype{methods} \name{[,testclass-method} \alias{[,testclass-method} \title{extract elements} \usage{ \s4method{[}{testclass}(x) } \arguments{ \item{x}{testclass} } \description{ extract elements } the following rd results in no error if define , document arguments
% generated roxygen2 (4.1.1): not edit hand % please edit documentation in r/test.r \doctype{methods} \name{[,testclass,missing,missing,missing-method} \alias{[,testclass,missing,missing,missing-method} \title{extract elements} \usage{ \s4method{[}{testclass,missing,missing,missing}(x, i, j, drop) } \arguments{ \item{x}{testclass} \item{i}{missing} \item{j}{missing} \item{drop}{missing} } \description{ extract elements }
you can try try like:
setmethod("[", signature(x="testclass", i="missing", j="missing", drop="missing"), ...) though seems pretty weird me you're not specifying i. set i "any".
also, have update @param tags like:
#' @param x testclass #' @param missing #' @param j missing #' @param drop missing you may not care parameters, using generic defines them ([) pretty obligated define them in method , such should define them in docs highlight particular method different generic. ?methods:
method definitions required have same formal arguments generic function, since method dispatch mechanism not rematch arguments, reasons of both efficiency , consistency.
Comments
Post a Comment