Skip to contents

Write a CSV file and track it with DVC

Usage

write_csv_dvc(
  x,
  path,
  message,
  stage_name = NULL,
  deps = NULL,
  params = NULL,
  metrics = FALSE,
  push = FALSE
)

Arguments

x

A data frame to write to CSV

path

Path to save the CSV file

message

Git commit message

stage_name

Optional DVC stage name

deps

Optional vector of dependency files

params

Optional list of parameters

metrics

Logical, whether to track as DVC metrics (default: FALSE)

push

Logical, whether to push changes to Git remote (default: FALSE)

Value

The input data frame (invisibly) to allow for further piping

Examples

if (FALSE) { # \dontrun{
# Simple tracking
data |> write_csv_dvc(
  "data/processed/results.csv",
  message = "Add processed results",
  push = TRUE
)

# As part of a pipeline
data |> write_csv_dvc(
  "data/processed/features.csv",
  message = "Add feature matrix",
  stage_name = "feature_engineering",
  deps = "data/raw/input.csv",
  params = list(n_components = 10),
  push = TRUE
)
} # }