find_id searches for survey names that match argument pattern. All arguments but first are passed to grepl for pattern matching.

find_id(pattern, first = TRUE, ignore.case = TRUE, perl = TRUE,
  fixed = FALSE)

Arguments

pattern

Character string containing a regular expression (or character string for fixed = TRUE).

first

Whether to return only the first match (default) or all matches. See Details.

ignore.case

if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching.

perl

logical. Should Perl-compatible regexps be used?

fixed

logical. If TRUE, pattern is a string to be matched as is. Overrides all conflicting arguments.

Value

A named character vector giving the id(s) of matching surveys, or an empty character vector if there are no matches.

Details

find_id retrieves the names and ids of all available surveys (using surveys), and then uses grepl to search the names for matches.

For first = TRUE (the default), only the id of the first matching name (if any) is returned. Matches are sorted by lastModified timestamp (descending), so first = TRUE gives the id of the matching survey most recently modified.

See also

surveys

Examples

# NOT RUN {
find_id("demographics")
# }