Hi Duncan,

thanks for the quick answer! 
Oops, I have really overseen the correct argument specs...
In the beginning roxygen did not support S4 but by now it does.
The usage line is created automatically by roxygen in this case (only when 
using S4 classes and I am not sure when and when not).
Not being an roxygen expert, I feel that roxygen limits the creation of .Rd 
files at some points but still is a great thing I use a lot.

For those interested, here is how it worked for me with roxygen:

#' Show method for testClass
#'
#' @param object a \code{testClass} object
#' @docType methods
#' @aliases show, testClass-method
#' @usage \S4method{show}{testClass}(object)
#'
setMethod("show", "testClass", function(object){
})

Mark

Am 20.12.2010 um 23:31 schrieb Duncan Murdoch:

> 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@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.
> 

–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Celler Straße 27
28205 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com






        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to