0

I'm reading data stored in several fst-files using tidyfst and purrr::map_dfr. The following example works as expected.

library(tidyverse)
library(fst)
library(tidyfst)

# get all fst files in current directory
files_fst <- file.path(list.files(pattern = ".fst"))

df <- map_dfr(files_fst,
              ~ parse_fst(.) %>% 
                filter_fst(country == "France")) %>%
  bind_rows()

However, using a variable containing the string for which I want to filter does not work:

country_in <- "France"

df <- map_dfr(files_fst,
              ~ parse_fst(.) %>% 
                filter_fst(country == country_in)) %>%
  bind_rows()

Any ideas what's the problem here?

mgrund
  • 1,415
  • 8
  • 10
  • Not able to reproduce your case with an example like `fst::write_fst(iris,"iris_test.fst"); v1 <- "setosa"; list(parse_fst("iris_test.fst"), parse_fst("iris_test.fst")) %>% map(~ .x %>% filter_fst(Species == v1))` – akrun Jan 04 '23 at 17:54
  • I assume that you don't have a column named `country_in` – akrun Jan 04 '23 at 17:59
  • Thanks for you comment, I made some adjustments, now it seems to work! – mgrund Jan 09 '23 at 09:05

0 Answers0