Return the appropriate function for reading the specified path/extension
file_fn.RdReturn the appropriate function for reading the specified path/extension
Arguments
- x
(character)The extension name or the path to the file- write
(logical)Return the writing function? DefaultFALSEto return the reading function
See also
Other file IO:
col_types(),
dep_read(),
dep_write(),
dir_fn(),
dirs,
ext(),
is_filepath(),
last_updated(),
list.files2(),
load_obj(),
make_names(),
mkpath(),
move_files_to_folder(),
needs_update(),
object_fn(),
object_write(),
package_size(),
write_dir_fn(),
write_lines()
Examples
file_fn("csv")
#> function (con = stdin(), n = -1L, ok = TRUE, warn = TRUE, encoding = "unknown",
#> skipNul = FALSE)
#> {
#> if (is.character(con)) {
#> con <- file(con, "r")
#> on.exit(close(con))
#> }
#> .Internal(readLines(con, n, ok, warn, encoding, skipNul))
#> }
#> <bytecode: 0x55c8974a77d0>
#> <environment: namespace:base>
file_fn("csv", write = TRUE)