Description Usage Arguments Examples
Select a range of records from an object
1 2 3 4 5 6 7 8 9 10 11 12 13 | slice_range(x, range, begin = range[1], end = range[2], ...)
## S3 method for class 'lvec'
slice_range(x, range, begin = range[1], end = range[2], as_r = FALSE, ...)
## S3 method for class 'ldat'
slice_range(x, range, begin = range[1], end = range[2], as_r = FALSE, ...)
## Default S3 method:
slice_range(x, range, begin = range[1], end = range[2], ...)
## S3 method for class 'data.frame'
slice_range(x, range, begin = range[1], end = range[2], ...)
|
x |
the object to select items from |
range |
a numeric vector with two elements specifying the range to select. |
begin |
the first element to select. |
end |
the last element to select. |
... |
ignored; used to pass additional arguments to other methods. |
as_r |
convert the result to an R-object. |
1 2 3 4 5 6 7 8 9 | x <- as_lvec(1:20)
# Select elements 5:7
slice_range(x, range = c(5, 7))
slice_range(x, begin = 5, end = 7)
slice_range(x, range = c(5, 10), end = 7)
# also works for R-vectors
slice_range(1:20, range = c(5,7))
# convert lvec to rvec
slice_range(x, range = c(5,7), as_r = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.