Skip to contents

For use in a function that takes dots

Usage

expr_savepath(..., .path = NULL, .file_suffix = ".xlsx", .tmp_prefix = "xlr-")

Arguments

...

an expression (unused if .path is specified)

.path

a full save path or file name string with out without suffix

.file_suffix

a file type, e.g. '.xlsx' or '.pdf'

.tmp_prefix

if producing a temp file, prefix before date and time name components, e.g. 'xlr'

Value

the complete path string

Examples

expr_savepath(.path = 'hi')
#> [1] "/home/runner/work/xlr/xlr/hi.xlsx"
iris |> expr_savepath()
#> [1] "/tmp/RtmpmudPUu/xlr-iris_20240105_0127_01806.xlsx"
iris |> expr_savepath(.path = 'hi')
#> [1] "/home/runner/work/xlr/xlr/hi.xlsx"
expr_savepath(iris, .file_suffix = '.pdf', .tmp_prefix = 'boing-')
#> [1] "/tmp/RtmpmudPUu/boing-iris_20240105_0127_01808.pdf"
# .path, if specified, overrides prefix
expr_savepath(.path = 'hi', .file_suffix = '.pdf', .tmp_prefix = 'boing-')
#> [1] "/home/runner/work/xlr/xlr/hi.pdf"
iris |> expr_savepath(.path = 'somewhere/hi/bye', .file_suffix = '.pdf')
#> [1] "/home/runner/work/xlr/xlr/somewhere/hi/bye.pdf"