selectMember: Return identifiers for objects that match search criteria

Description Usage Arguments Details Value See Also Examples

Description

Return DataObjects or DataObject identifiers that match search terms.

Usage

1
2
3
4
selectMember(x, ...)

## S4 method for signature 'DataPackage'
selectMember(x, name, value, as = "character")

Arguments

x

A DataPackage instance

...

(Not yet used)

name

The name of the DataObject slot to inspect, for example "[email protected]".

value

A character or logical value to match. If specified as a character value, PERL style regular expressions can be used (see ?grepl).

as

A character value to specify the return type, either "DataObject" or "character" (the default)

Details

The "selectMember" method inspects the DataObject slot "name" for a match with "value" for each DataObject in a DataPackage. Matching DataObjects are returned as a list containing either package member identifiers (character) or the DataObjects themselves, depending on the value of the as parameter.

Value

A list of matching DataObjects or DataObject identifiers. The default is to return a list of DataObject identifiers.

See Also

DataPackage-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#' library(datapack)
dp <- new("DataPackage")
# Add the script to the DataPackage
progFile <- system.file("./extdata/pkg-example/logit-regression-example.R", package="datapack")
# An 'id' parameter is not specified, so one will be generated automatically.
progObj <- new("DataObject", format="application/R", filename=progFile)
dp <- addMember(dp, progObj)

# Add a script input to the DataPackage
inFile <- system.file("./extdata/pkg-example/binary.csv", package="datapack") 
inObj <- new("DataObject", format="text/csv", filename=inFile)
dp <- addMember(dp, inObj)

# Add a script output to the DataPackage
outFile <- system.file("./extdata/pkg-example/gre-predicted.png", package="datapack")
outObj <- new("DataObject", format="image/png", file=outFile)
dp <- addMember(dp, outObj)

# Now determine the package member identifier for the R script
progIds  <- selectMember(dp, name="[email protected]", value="application/R", as="character")
inputId <- selectMember(dp, name="[email protected]", value="binary.csv")

ropensci/datapack documentation built on Aug. 11, 2018, 3:46 a.m.