find_id: Find survey ids by searching survey names

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
2
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.

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.

Value

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

See Also

surveys

Examples

1
2
3
4
## Not run: 
find_id("demographics")

## End(Not run)

jamesdunham/qsurvey documentation built on May 18, 2019, 11:20 a.m.