[R] .Rd file for S4-method warning

Duncan Murdoch murdoch.duncan at gmail.com
Mon Dec 20 23:31:31 CET 2010


On 20/12/2010 5:18 PM, Mark Heckmann wrote:
> Dear R users,
>
> I want to create a proper .Rd file for the show method for an S4 class.
> I am encountering problems in the \usage{} line, I guess. An example:
>
> setClass("testClass",
>          representation(a="character"))
>
> setMethod("show", "testClass", function(object){
> })
>
>
> The .Rd file:
>
> \name{show,-method}
> \alias{show,testClass-method}
> \alias{show}
> \title{Show method for testClass...}
> \usage{\S4method{show}{testClass}(object)
> }
> \description{Show method for testClass}
> \arguments{\item{testClass}{object}
> }
>
> CHECK says:
> * checking Rd \usage sections ... WARNING
> Undocumented arguments in documentation object 'show,-method'
>   object
>
> What would be a correct \usage line? Writing R extensions says:
> \S4method{generic}{signature_list}(argument_list)

That's okay, the warning is about the fact that you didn't document 
object in the \arguments section.

You had

\item{testClass}{object}

but you should have had

\item{object}{some description of what object is}

As yours was written, it's documentation for the "testclass" argument, 
which doesn't exist.

> What am I doing wrong?
> It works though if I simply delete the \usage line.
> Unfortunately I use roxygen and the line is created automatically,
> so I need to create it properly.

Does roxygen also create the argument?  Looks like a bug or limitation 
(I seem to recall that roxygen doesn't support S4, or didn't in the past...)

Duncan Murdoch

>
> Thanks in advance,
> Mark
> –––––––––––––––––––––––––––––––––––––––
> Mark Heckmann
> Blog: www.markheckmann.de
> R-Blog: http://ryouready.wordpress.com
>
>
>
>
>
>
> 	[[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list