chmFieldAccessFunction: Get Javascript function name for accessing a specific string...

View source: R/zzz.R

chmFieldAccessFunctionR Documentation

Get Javascript function name for accessing a specific string field in each element of string vector.

Description

This function returns the name of a Javascript function thats accepts a string vector as its parameter, and for each string in the vector splits the string into fields separated by fieldsep, and accesses field idx (zero origin). The function returns a vector of these fields.

Usage

chmFieldAccessFunction(fieldsep, idx)

Arguments

fieldsep

The separator to be used for splitting the input string. This should be a single character string.

idx

The index (zero origin) of the field to be returned after splitting the input string. This should be a single integer.

Details

The name of the function returned for a specific fieldsep and idx will be constant within an R session, but may differ between R sessions (or if this library is unloaded and reloaded).

Value

The name of the newly created field access function.

See Also

chmGetFunction()

chmStringopFunction()

Examples

# Create a new field access function that splits the input string at ',' and
# returns the first field.
chmFieldAccessFunction(',', 1)
# Create a new field access function that splits the input string at '-' and
# returns the second field.
chmFieldAccessFunction('-', 2)


MD-Anderson-Bioinformatics/NGCHM-R documentation built on April 1, 2024, 12:34 p.m.