It is often faster to fetch counts of data, rather than the entire dataset.
If your fnFetchData() function is already fast, however, this function
allows you to construct a simple data counter from your data fetcher.
Arguments
- fnFetchData
functionA function that takes astrDomainIDargument and optionalstrGroupID,strGroupLevel,strSubjectID, and/ordSnapshotDate, and returns a data.frame. Seesample_fnFetchData()for an example. The returned data.frame contains information about the named domain. If the function throws an error, the error is elevated to the user, so you can use errors to pass requirements through to the user.
Examples
fnDataCounter <- ConstructDataCounter(sample_fnFetchData)
fnDataCounter("AE") == nrow(sample_fnFetchData("AE"))
#> [1] TRUE