
Last chance! 50% off unlimited learning
Sale ends in
Read elements from an lvec
lget(x, ...)# S3 method for lvec
lget(x, index = NULL, range = NULL, ...)
# S3 method for default
lget(x, index = NULL, range = NULL, ...)
# S3 method for data.frame
lget(x, index = NULL, range = NULL, ...)
Returns an lvec
with the selected elements. In order to convert
the selection to an R-vector as_rvec
can e used.
the lvec
to read from
used to pass on additional arguments to other methods.
a logical or numeric vector to index x
with
a numeric vector of length 2 specifying a range of elements
to select. Specify either index
or range
.
Indexing using index
should follow the same rules as indexing a regular
R-vector using a logical or numeric index. The range given by range
includes both end elements. So, a range of c(1,3)
selects the first
three elements.
a <- as_lvec(letters[1:4])
# Select first two elements
lget(a, 1:2)
lget(a, c(TRUE, TRUE, FALSE, FALSE))
lget(a, range = c(1,2))
# Logical indices are recycled: select odd elements
lget(a, c(TRUE, FALSE))
Run the code above in your browser using DataLab