sqextract | R Documentation |
Operator to extract subsets of sq objects.
x |
[ |
i , j , ... |
[ |
This function follows vctrs-package
conventions
regarding argument interpretation for indexing vectors, which are a bit
stricter that normal R conventions, for example implicit argument recycling
is prohibited. Subsetting of the sq
object does not affect its
attributes (class and alphabet of the object). Attempt to extract elements
using indices not present in the object will return an error.
sq
object of the same type as the input,
containing extracted elements
Functions from utility module:
==.sq()
,
get_sq_lengths()
,
is.sq()
,
sqconcatenate
# Creating object to work on:
sq_unt <- sq(c("AHSNLVSCTK$SH%&VS", "YQTVKA&#BSKJGY",
"IAKVGDCTWCTY>", "AVYI#VSV&*DVGDJCFA"))
# Subsetting using numeric vectors
# Extracting second element of the object:
sq_unt[2]
# Extracting elements from second to fourth:
sq_unt[2:4]
# Extracting all elements except the third:
sq_unt[-3]
# Extracting first and third element:
sq_unt[c(1,3)]
# Subsetting using logical vectors
# Extracing first and third element:
sq_unt[c(TRUE, FALSE, TRUE, FALSE)]
# Subsetting using empty vector returns all values:
sq_unt[]
# Using NULL, on the other hand, returns empty sq:
sq_unt[NULL]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.