TestRefEntries: A class for accessing the test reference entries.

TestRefEntriesR Documentation

A class for accessing the test reference entries.

Description

A class for accessing the test reference entries.

A class for accessing the test reference entries.

Details

The test reference entries are stored as JSON files inside inst/testref folder of each extension package.

Methods

Public methods


Method new()

New instance initializer.

Usage
TestRefEntries$new(db.class, pkgName, folder = NULL, bdb = NULL)
Arguments
db.class

Identifier of the database.

pkgName

Name of the package in which are stored the reference entry files.

folder

The folder where to find test reference files for the package. Usually it is "inst/testref".

bdb

A valid BiodbMain instance or NULL.

Returns

Nothing.


Method getAllIds()

Retrieve all identifiers.

Usage
TestRefEntries$getAllIds(limit = 0)
Arguments
limit

The maximum number of identifiers to return.

Returns

A character vector containing the IDs.


Method getContents()

Get the reference contents for the specfied IDs.

Usage
TestRefEntries$getContents(ids)
Arguments
ids

The reference IDs for which to get the contents.

Returns

A character vector.


Method getRealEntries()

Retrieve all real entries from database corresponding to the reference entris.

Usage
TestRefEntries$getRealEntries(ids = NULL)
Arguments
ids

A character vector of entry identifiers.

Returns

A list containing BiodbEntry instances.


Method saveEntriesAsJson()

Saves a list of entries into separate JSON files, inside the test output folder.

Usage
TestRefEntries$saveEntriesAsJson(ids, entries)
Arguments
ids

The IDs of the entries.

entries

A list of entries. It can contain NULL values.

Returns

Nothing.


Method getRealEntry()

Retrieves one real entry from database corresponding to one reference entry.

Usage
TestRefEntries$getRealEntry(id)
Arguments
id

The identifier of the entry.

Returns

A BiodbEntry instance.


Method getRefEntry()

Retrieves the content of a single reference entry.

Usage
TestRefEntries$getRefEntry(id)
Arguments
id

The identifier of the reference entry to retrieve.

Returns

The content of the reference entry as a list.


Method getAllRefEntriesDf()

Load all reference entries.

Usage
TestRefEntries$getAllRefEntriesDf()
Returns

A data frame containing all the reference entries with their values.


Method clone()

The objects of this class are cloneable with this method.

Usage
TestRefEntries$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# Creates an instance
refEntries <- TestRefEntries$new('comp.sqlite', pkgName='biodb')

# Gets identifiers of all reference entries
refEntries$getAllIds()

# Gets a data frame with the content of the reference entries
refEntries$getAllRefEntriesDf()


pkrog/biodb documentation built on Nov. 29, 2022, 4:24 a.m.