in_csquares {csquares} | R Documentation |
Match c-squares against other c-squares (with wildcards)
Description
Checks if csquares codes in table
matches values in x
. Wildcards
are allowed in table
for this comparison. Check out vignette("wildcards")
for more details.
Usage
in_csquares(x, table, strict = FALSE, mode = "any", ...)
Arguments
x |
An object of class 'csquares' that will be checked for matching
values in |
table |
A |
strict |
When set to |
mode |
Two modes are allowed: |
... |
Ignored |
Value
Returns a vector of logical
values with the same number of
elements or rows as x
Author(s)
Pepijn de Vries
Examples
library(dplyr)
in_csquares(orca$csquares, c("3400:2", "5515:3"))
in_csquares(orca$csquares, "3400:2|5515:3")
## Percentage symbols are interpreted the same as asterisk symbols
## both are wild cards
in_csquares(orca$csquares, "1%%%:%") |>
table()
## Same as above
in_csquares(orca$csquares, "1***:*") |>
table()
## Also same as above
in_csquares(orca$csquares, "1***", strict = FALSE) |>
table()
## Strict interpretation results in no matches
in_csquares(orca$csquares, "1***", strict = TRUE) |>
table()
## Filter orca data to North Eastern quadrant (1***:*) only:
orca |>
filter(
in_csquares(csquares, "1***:*")
) |>
nrow()