Feature Idea: tar_files() works with a scalar character filename #69
Replies: 2 comments 2 replies
-
Hello, library(targets)
tar_script({
library(tarchetypes)
# Create a file for use
cat("foo", file="testfile.txt")
list(
tar_file(
filename,
"testfile.txt"
)
)
})
tar_make()
#> • start target filename
#> • built target filename
#> • end pipeline Created on 2021-09-15 by the reprex package (v2.0.1) |
Beta Was this translation helpful? Give feedback.
-
@ginolhac Thanks for the information above. I have two reasons for the request related to My first reason is a simple one: The error message when using My second reason is to simplify the use case. I'm not sure why The reason I wanted the second use case is because I often work with a set of files that are supposed to have the same structure-- but they don't always have the same structure. So, I like to get the code working with one file and add more files one-by-one. A simple work-around for this use case is to just wrap the filename in But, wrapping in Overall, my goal with this request is to make |
Beta Was this translation helpful? Give feedback.
-
As you're probably noticing with all the activity from me about targets and now tarchetypes, I'm learning the conversion from
drake
totargets
!I just tried to use
tar_files()
on a single file to test it out, but I got an error,Error: callr subprocess failed: command must be a language object.
I think that one of two things would be preferable:tar_files()
works with just a character scalar instead of requiring a language object. (My preference, but it could add unnecessary effort to code maintainability for a potentially low-value feature.)tar_files()
were clearer that you should wrap the character string inc()
(or whatever the preference is with another method).Reprex (which will leave a file named "textfile.txt" on your system-- I don't know how to make a real reprex that will also clean up after itself for this one):
Beta Was this translation helpful? Give feedback.
All reactions