Returns a sample of the specified size from the values of track expression.

gsample(expr = NULL, n = NULL, intervals = NULL, iterator = NULL, band = NULL)

Arguments

expr

track expression

n

a number of items to choose

intervals

genomic scope for which the function is applied

iterator

track expression iterator. If 'NULL' iterator is determined implicitly based on track expression.

band

track expression band. If 'NULL' no band is used.

Value

An array that represent quantiles.

Details

This function returns a sample of the specified size from the values of track expression. If 'n' is less than the total number of values, the data is randomly sampled. The seed of the pseudo-random generator can be controlled through 'grnd.seed' option.

If 'n' is higher than the total number of values, all values are returned (yet reshuffled).

See also

Examples

# \dontshow{
options(gmax.processes = 2)
# }

gdb.init_examples()
gsample("sparse_track", 10)
#>  [1] 0.36 0.48 0.36 0.48 0.52 0.42 0.40 0.36 0.44 0.40