grab_index: Get Elements Matching Between 2 Points

Description Usage Arguments Value Examples

View source: R/grab_index.R

Description

Use regexes to get all the elements between two points.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
grab_index(x, from = NULL, to = NULL, ...)

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

## Default S3 method:
grab_index(x, from = NULL, to = NULL, ...)

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

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

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.

Value

Returns a subset of the original data set.

Examples

1
2
3
4
5
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)

textshape documentation built on May 29, 2021, 1:07 a.m.