I want to read a large .txt file into R using the vroom
package, because is fast and supports pipe connections for pre-filtering.
For reproducibility, let's read this UK cats csv file from the Tidy Tuesday project and pre-filter for id == "Ares". The first column corresponds to the tag_id.
The following code returns an empty dataframe. How to fix the filter and what changes are required to filter by regular expressions instead of == "Ares"?
cats_file <- "https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-01-31/cats_uk.csv"
vroom(
file = pipe(paste("awk -F ',' '{ if ($1 == 'Ares') { print } }'", cats_file)),
delim = ","
)