Learn R Programming

textshape (version 1.7.5)

grab_index: Get Elements Matching Between 2 Points

Description

Use regexes to get all the elements between two points.

Usage

grab_index(x, from = NULL, to = NULL, ...)

# S3 method for character grab_index(x, from = NULL, to = NULL, ...)

# S3 method for default grab_index(x, from = NULL, to = NULL, ...)

# S3 method for list grab_index(x, from = NULL, to = NULL, ...)

# S3 method for data.frame grab_index(x, from = NULL, to = NULL, ...)

# S3 method for matrix grab_index(x, from = NULL, to = NULL, ...)

Value

Returns a subset of the original data set.

Arguments

x

A character vector, data.frame, or list.

from

An integer to start from (if NULL defaults to the first element/row).

to

A integer to get up to (if NULL defaults to the last element/row).

...

ignored.

Examples

Run this code
grab_index(DATA, from = 2, to = 4)
grab_index(DATA$state, from = 2, to = 4)
grab_index(DATA$state, from = 2)
grab_index(DATA$state, to = 4)
grab_index(matrix(1:100, nrow = 10), 2, 4)

Run the code above in your browser using DataLab