I suppose the source for ?"%in%" in base would be a good place to
look:
=======================\name{match}
\alias{match}
\alias{\%in\%}
[...]
\usage{
match(x, table, nomatch = NA, incomparables = FALSE)
x \%in\% table
}
[...]
\details{
\code{\%in\%} is currently defined as \cr
\code{"\%in\%" <- function(x, table) match(x, table, nomatch = 0)
> 0}
[...]
\examples{
[...]
1:10 \%in\% c(1,3,5,9)
sstr <-
c("c","ab","B","bba","c","@","bla","a","Ba","\%")
sstr[sstr \%in\% c(letters,LETTERS)]
"\%w/o\%" <- function(x,y) x[!x \%in\% y] #-- x without y
(1:10) \%w/o\% c(3,7,12)
}
[...]
Andy
> From: Robin Hankin
>
> Professor Ripley
>
> thanks for this. Very much appreciated.
>
> The original subject line reflected my late-night conviction
> that the answer might involve passing a strange list to do.call().
>
> Anyway, package magic is broken (only in R-devel, I might
> add) because I have
> a function called "%eq%".
>
> R-2.0.0 CMD check is stopping (I think) because it interprets the
> "%" as a control character.
>
> Does anyone have a best-practice example of a package that
> includes a
> function like "%eq%" that I could modify? In particular, how do
I get
> \usage{m1 %eq% m2} and \examples{..} to work nicely?
>
>
> best wishes
>
>
> rksh
>
>
> >
> >
> >
> >>What has this to do with the original subject line?
> Replacement functions
> >>are not intended to be used directly, and certainly not in do.call.
> >>
> >>See ?aperm, as in
> >>
> >>xx <- x
> >>dim(xx) <- c(2,2,3,3)
> >>xx <- aperm(xx, c(1,3,2,4))
> >>dim(xx) <- c(6, 6)
> >>xx
> >>
> >>as required.
> >>
> >>BTW, you have a broken package `magic' on CRAN: please do
> us the courtesy
> >>of fixing it so we don't continually have to look at it in
> tests. See
> >>
> >>http://cran.r-project.org/src/contrib/checkSummary.html
>
> --
> Robin Hankin
> Uncertainty Analyst
> Southampton Oceanography Centre
> SO14 3ZH
> tel +44(0)23-8059-7743
> initialDOTsurname at soc.soton.ac.uk (edit in obvious way; spam
> precaution)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>