add_filename: Add the data filename as a column

View source: R/dplyr-funcs-augmented.R

add_filenameR Documentation

Add the data filename as a column

Description

This function only exists inside arrow dplyr queries, and it only is valid when querying on a FileSystemDataset.

Usage

add_filename()

Details

To use filenames generated by this function in subsequent pipeline steps, you must either call compute() or collect() first. See Examples.

Value

A FieldRef Expression that refers to the filename augmented column.

Examples

## Not run: 
open_dataset("nyc-taxi") %>% mutate(
  file =
    add_filename()
)

# To use a verb like mutate() with add_filename() we need to first call
# compute()
open_dataset("nyc-taxi") %>%
  mutate(file = add_filename()) %>%
  compute() %>%
  mutate(filename_length = nchar(file))

## End(Not run)


arrow documentation built on Sept. 11, 2024, 8:02 p.m.