Learn R Programming

tcR (version 2.2.4)

top.fun: Get samples from a repertoire slice-by-slice or top-by-top and apply function to them.

Description

Functions for getting samples from data frames either by consequently applying head functions (top.fun) or by getting equal number of rows in the moving window (slice_fun) and applying specified function to this samples.

Usage

top.fun(.data, .n, .fun, ..., .simplify = T)

slice_fun(.data, .size, .n, .fun, ..., .simplify = T)

Arguments

.data

Data.frame, matrix, vector or any enumerated type or a list of this types.

.n

Vector of values passed to head function for top.fun or the number of slices for slice_fun.

.fun

Funtions to apply to every sample subset. First input argument is a data.frame, others are passed as ....

...

Additional parameters passed to the .fun.

.simplify

if T then try to simplify result to a vector or to a matrix if .data is a list.

.size

Size of the slice for sampling for slice_fun.

Value

List of length length(.n) for top.fun or .n for slice_fun.

Examples

Run this code
# NOT RUN {
# Get entropy of V-usage for the first 1000, 2000, 3000, ... clones.
res <- top.fun(immdata[[1]], 1000, entropy.seg)
# Get entropy of V-usage for the interval of clones with indices [1,1000], [1001,2000], ...
res <- top.fun(immdata[[1]], 1000, entropy.seg)
# }

Run the code above in your browser using DataLab