paths {fritools}R Documentation

Set or Get the path Attribute to or from an Object

Description

We set paths on some objects, these are convenience wrappers to attr.

Usage

get_path(x, force = FALSE)

set_path(x, path, action = c(NA, "read", "write"), overwrite = FALSE)

Arguments

x

An object.

force

Force the retrieval, even if the path is not valid? Only meant for unit testing, leave alone!

path

The path to be set.

action

Do we have a read or write process? Passed by read_csv and write_csv. Leave alone otherwise.

overwrite

Overwrite an existing path attribute instead of throwing an error?

Value

For get_path the value of attr(x, "path").

For set_path the modified object.

See Also

Other file utilities: clipboard_path(), delete_trailing_blank_lines(), delete_trailing_whitespace(), develop_test(), file_copy(), file_modified_last(), file_save(), find_files(), get_lines_between_tags(), get_mtime(), get_unique_string(), grep_file(), is_files_current(), is_path(), search_files(), split_code_file(), touch()

Examples

x <- 2
path <- tempfile()
touch(path)
x <- set_path(x, path)
get_path(x)

[Package fritools version 4.3.0 Index]