Created
April 9, 2020 05:43
-
-
Save joelnitta/13add5bb2090178b96868aac9ad91afb to your computer and use it in GitHub Desktop.
Extract raw data file names from a drake plan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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