| create_index | R Documentation |
Builds a persistent hash index stored as a .vtri sidecar file alongside
the .vtr file. The index maps key hashes to row group indices, enabling
O(1) row group identification for equality predicates (filter(col == value)).
create_index(path, column, ci = FALSE)
path |
Path to a |
column |
Character vector. Name(s) of column(s) to index. |
ci |
Logical. Build a case-insensitive index? Default |
For composite indexes on multiple columns, pass a character vector.
Composite indexes accelerate AND-combined equality predicates
(e.g., filter(col1 == "a", col2 == "b")).
The index is automatically loaded by tbl() when present. It composes with
zone-map pruning and binary search on sorted columns.
Invisible NULL. The index is written as a .vtri sidecar file.
f <- tempfile(fileext = ".vtr")
write_vtr(data.frame(id = letters, val = 1:26, stringsAsFactors = FALSE), f)
create_index(f, "id")
tbl(f) |> filter(id == "m") |> collect()
unlink(c(f, paste0(f, ".id.vtri")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.