Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joelnitta/13add5bb2090178b96868aac9ad91afb to your computer and use it in GitHub Desktop.
Save joelnitta/13add5bb2090178b96868aac9ad91afb to your computer and use it in GitHub Desktop.
Extract raw data file names from a drake plan
library(tidyverse)
# Extract names of files in a "data_raw" folder
# and append "put" so they can easily be uploaded to
# a server using sftp
plan_lines <- read_lines("code/world_biogeo_plan.R")
plan_lines %>%
magrittr::extract(str_detect(., "data_raw")) %>%
str_match('data_raw\\/([^\\"]+)?\\"') %>%
magrittr::extract(,2) %>%
unique %>%
sort %>%
paste("put", .)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment