fetchSamples {pepr} | R Documentation |
Collect samples fulfilling the specified requirements
Description
This funciton collects the samples from a data.table-class
object that
fulfill the requirements of an attribute attr
specified with
the fun
argument
Usage
fetchSamples(samples, attr = NULL, func = NULL, action = "include")
Arguments
samples |
an object of |
attr |
a string specifying a column in the |
func |
an anonymous function, see Details for more information |
action |
a string (either |
Details
The anonymous function provided in the func
argument has to return an integer that indicate the rows that the action
should be performed on.
Core expressions which are most useful to implement the anonymous function are:
Value
an object of data.table-class
class filtered according to specified requirements
Examples
projectConfig = system.file("extdata", "example_peps-master",
"example_amendments1", "project_config.yaml", package="pepr")
p = Project(projectConfig)
s = sampleTable(p)
fetchSamples(s,attr = "sample_name", func=function(x){ which(x=="pig_0h") },action="include")
fetchSamples(s,attr = "sample_name", func=function(x){ which(x=="pig_0h") },action="exclude")
fetchSamples(s,attr = "sample_name", func=function(x){ grep("pig_",x) },action="include")
[Package pepr version 0.5.0 Index]