Learn R Programming

tidyft (version 0.9.20)

fst: Parse,inspect and extract data.table from fst file

Description

An API for reading fst file as data.table.

Usage

parse_fst(path)

slice_fst(ft, row_no)

select_fst(ft, ...)

filter_fst(ft, ...)

summary_fst(ft)

Value

parse_fst returns a fst_table class.

select_fst and filter_fst returns a data.table.

Arguments

path

path to fst file

ft

An object of class fst_table, returned by parse_fst

row_no

An integer vector (Positive)

...

The filter conditions

Details

summary_fst could provide some basic information about the fst table.

See Also

fst, metadata_fst

Examples

Run this code

  # write the file first
  path = tempfile(fileext = ".fst")
  fst::write_fst(iris,path)
  # parse the file but not reading it
  parse_fst(path) -> ft

  ft

  class(ft)
  lapply(ft,class)
  names(ft)
  dim(ft)
  summary_fst(ft)

  # get the data by query
  ft %>% slice_fst(1:3)
  ft %>% slice_fst(c(1,3))

  ft %>% select_fst(Sepal.Length)
  ft %>% select_fst(Sepal.Length,Sepal.Width)
  ft %>% select_fst("Sepal.Length")
  ft %>% select_fst(1:3)
  ft %>% select_fst(1,3)
  ft %>% select_fst("Se")

  # return a warning with message
  # \donttest{
    ft %>% select_fst("nothing")
  # }

  ft %>% select_fst("Se|Sp")
  ft %>% select_fst(cols = names(iris)[2:3])

  ft %>% filter_fst(Sepal.Width > 3)
  ft %>% filter_fst(Sepal.Length > 6 , Species == "virginica")
  ft %>% filter_fst(Sepal.Length > 6 & Species == "virginica" & Sepal.Width < 3)

Run the code above in your browser using DataLab