MatchListMembers: Find the members in a list matching a member expression

View source: R/PCM.R

MatchListMembersR Documentation

Find the members in a list matching a member expression

Description

Find the members in a list matching a member expression

Usage

MatchListMembers(object, member, enclos = "?", q = "'", ...)

Arguments

object

a list containing named elements.

member

a member expression. Member expressions are character strings denoting named elements in a list object (see examples).

enclos

a character string containing the special symbol '?'. This symbol is to be replaced by matching expressions. The result of this substitution can be anything but, usually would be a valid R expression. Default: "?".

q

a quote symbol, Default: "'".

...

additional arguments passed to grep. For example, these could be ignore.case=TRUE or perl=TRUE.

Value

a named character vector, with names corresponding to the matched member quoted expressions (using the argument q as a quote symbol), and values corresponding to the 'enclos-ed' expressions after substituting the '?'.

See Also

PCMListMembers

Examples

model <- PCMBaseTestObjects$model_MixedGaussian_ab
MatchListMembers(model, "Sigma_x", "diag(model?[,,1L])")
MatchListMembers(model, "S.*_x", "diag(model?[,,1L])")
MatchListMembers(model, "Sigma_x", "model?[,,1L][upper.tri(model?[,,1L])]")
MatchListMembers(model, "a$Sigma_x", "model?[,,1L][upper.tri(model?[,,1L])]")


PCMBase documentation built on Nov. 18, 2022, 9:06 a.m.