findElement does a fuzzy search for an element model, using agrep(). The output (if any) is in the form of suggested calls to element-creating functions anchor(), chain(), connector(), float(), instrument(), misc() and wire(). The list is in alphabetical order, not the order of the closeness of the match.

findElement(
  e,
  search = c("anchor", "chain", "connector", "float", "instrument", "wire"),
  ignore.case = TRUE,
  max.distance = 0.1
)

Arguments

e

character value to be used for the fuzzy match, passed on to agrep().

character vector holding the categories to be searched for.

ignore.case

logical value, passed to agrep(). The default is to ignore case.

max.distance

numeric value, passed to agrep(). The default usually catches relevant cases; see the documentation for agrep() for the (somewhat subtle) meaning of this argument.

Value

findElement returns (silently) a list of the suggested function calls.

Details

findElement is used by e.g. float("?BUB").

Author

Dan Kelley

Examples

library(mooring)
findElement("nylon")
#> Some possible matches:
#>      wire("1 Nylon") 
#>      wire("3/4in Nylon") 
#>      wire("5/8in Nylon")