[Rd] \S4method in combination with "[" and "[<-"

Sklyar, Oleg (MI London) osklyar at maninvestments.com
Wed May 21 12:01:28 CEST 2008


For the $ operator defined as S4 method, \S4method does not work as
well. However, the following clauses let it through the check w/o
warnings or errors:

\alias{$,character-method}
\alias{$<-,character,ANY-method}

\usage{
    ## S4 methods for signature 'MyClass,character'
    x$name
    x$name <- value
}

So, why not to try the following?

\usage{
    ## S4 methods for ...
    [(x, i, j, ..., drop=TRUE)
    [(x, i, j, ...) <- value
}

Dr Oleg Sklyar
Technology Group
Man Investments Ltd
+44 (0)20 7144 3803
osklyar at maninvestments.com 

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of Robin Hankin
> Sent: 21 May 2008 09:41
> To: Matthias Kohl
> Cc: r-devel at r-project.org; Dr. Peter Ruckdeschel
> Subject: Re: [Rd] \S4method in combination with "[" and "[<-"
> 
> Hello Matthias
> 
> I too struggled with this for a long long time.
> 
> I'm not sure if this answers your question, but 
> Brobdingnag_1.1-2.tar.gz is clean under R-2.7.0, and this 
> package includes S4 methods for extract/replace.
> 
> Extract.Rd in the package doesn't use \S4method; also, I 
> couldn't figure out how to include a "usage" section without 
> R CMD check throwing a wobbly.
> 
> Extract.Rd is not ideal, but
> seems to work in practice: the user types ?"[.brob"
> and gets some support, but it would have been better to have 
> an explicit usage section too.
> 
> 
> best wishes
> 
> 
> rksh
> 
> 
> 
> 
> 
> On 21 May 2008, at 09:23, Matthias Kohl wrote:
> 
> > Dear developers,
> >
> > We want to use "\S4method" to document new S4-methods for "[" and 
> > "[<-". We use this for other functions/methods and it works without 
> > any problem, but in case of "[" and "[<-" we didn't manage to bring 
> > this to work.
> >
> > The problem occurs in the development version of our package 
> > "distrSim" which can be found under 
> > http://r-forge.r-project.org/R/?group_id=87
> > .
> >
> > The warning we obtain is
> >
> > Bad \usage lines found in documentation object 'Subsetting-methods':
> > \S4method{[}{SeqDataFrames}(x, i, j, k, drop = FALSE) 
> > \S4method{[<-}{SeqDataFrames}(x, i, j, k, value)
> >
> > Of course, we tried several different possibilities but with no 
> > success.
> >
> > Does someone know a package which shows a use case for this 
> situation? 
> > I looked in several packages but could not found any.
> >
> > Thanks for your help!
> > Matthias
> >
> > --
> > Dr. Matthias Kohl
> > www.stamats.de
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> --
> Robin Hankin
> Uncertainty Analyst and Neutral Theorist, National 
> Oceanography Centre, Southampton European Way, Southampton 
> SO14 3ZH, UK
>   tel  023-8059-7743
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 


**********************************************************************
The contents of this email are for the named addressee(s...{{dropped:22}}



More information about the R-devel mailing list