File: matchfuns.Rd

package info (click to toggle)
r-cran-registry 0.5-1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 372 kB
  • sloc: sh: 9; makefile: 5
file content (65 lines) | stat: -rwxr-xr-x 1,814 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
\name{matchfuns}
\alias{matchfuns}
\alias{match_ignorecase}
\alias{match_exact}
\alias{match_partial}
\alias{match_partial_ignorecase}
\alias{match_regexp}
\title{Matching functions}
\description{
  Functions used for lookups of search keys.
}
\usage{
match_ignorecase(lookup, entry, \dots)
match_exact(lookup, entry, \dots)
match_partial(lookup, entry, \dots)
match_partial_ignorecase(lookup, entry, \dots)
match_regexp(lookup, entry, \dots)
}
\arguments{
  \item{lookup}{Search value to look up (for some key field).}
  \item{entry}{Vector of key values where \code{lookup} is sought.}
  \item{\dots}{For \code{match_ignorecase} and \code{match_exact}:
    currently not used. For \code{match_partial} and
    \code{match_partial_ignorecase}: additional arguments passed to
    \code{\link[base]{pmatch}}. For \code{match_regexp}: additional
    arguments passed to \code{\link[base]{grep}}.}
}
\details{
  These are matching functions to be specified for key fields,
  controlling how search values are looked up in the registry.
}
\author{David Meyer \email{David.Meyer@R-project.org}}

\seealso{\code{\link{regobj}}}

\examples{
## use exact matching
R <- registry(stop_if_missing = FALSE)
R$set_field("Key", type = "character", is_key = TRUE, index_FUN = match_exact)
R$set_field("Value", type = "numeric")
R$set_entry("the key", 1)

R[["the key"]]
R[["the"]]

## use partial matching
R <- registry()
R$set_field("Key", type = "character", is_key = TRUE, index_FUN = match_partial)
R$set_field("Value", type = "numeric")
R$set_entry("the key", 1)

R[["the"]]

## use regular expressions
R <- registry()
R$set_field("Key", type = "character", is_key = TRUE, index_FUN = match_regexp)
R$set_field("Value", type = "numeric")
R$set_entry("the key", 1)
R$set_entry("key", 2)

R[["k.*"]]
R["k.*"]

}
\keyword{data}