dsSearch: Search a dataset by string matching against the names stored...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/functions.R

Description

The function allows string matching against some of the fields "identification", "fullName", "dirName", "files" of the structure describing the data sets.

Usage

1
2
dsSearch(dsList, id, searchField=c("identification", "fullName", "dirName", "files"),
            searchType=c("exact", "prefix", "suffix", "anywhere"), caseSensitive=FALSE)

Arguments

dsList

Data frame as created by prepareDSList().

id

Character of length one or numeric of length at most nrow(dsList). If character, then it is used as a search string to be matched against the names of datasets. If numeric, it is used as indices of data sets in dsList.

searchField

Character. Name of a column in dsList to be searched.

searchType

Character. Type of search.

caseSensitive

Logical. Whether the search should be case sensitive.

Details

The parameter searchField determines, which column of dsList is searched, parameters searchType and caseSensitive influence the type of search. These three parameters are ignored, if id is numeric.

Regular expressions are not used. Matching with searchType="exact" is done with ==, searchType="prefix" and searchType="suffix" are implemented using substr(), searchType="anywhere" is implemented using grep(, fixed=TRUE).

Value

Data frame containing the indices and identification of the matching data sets and the value of the search field, if applicable.

Author(s)

Petr Savicky

See Also

readMLData.

Examples

1
2
3
4
  pathData <- getPath("exampleData")
  pathDescription <- getPath("exampleDescription")
  dsList <- prepareDSList(pathData, pathDescription)
  dsSearch(dsList, "ident", searchField="fullName", searchType="anywhere")

Example output

3 data sets available
  ind identification             fullName
1   2          glass Glass Identification

readMLData documentation built on May 2, 2019, 7:49 a.m.