View source: R/archive_write_files.R
archive_write_dir | R Documentation |
archive_write_files()
adds one or more files to a new archive.
archive_write_dir()
adds all the file(s) in a directory to a new archive.
archive_write_dir(
archive,
dir,
format = NULL,
filter = NULL,
options = character(),
...,
recursive = TRUE,
full.names = FALSE
)
archive_write_files(
archive,
files,
format = NULL,
filter = NULL,
options = character()
)
archive |
|
dir |
|
format |
|
filter |
|
options |
|
... |
additional parameters passed to |
recursive |
logical. Should the listing recurse into directories? |
full.names |
a logical value. If |
files |
|
An 'archive' object representing the new archive (invisibly).
An 'archive' object representing the new archive (invisibly).
if (archive:::libarchive_version() > "3.2.0") {
# write some files to a directory
d <- tempfile()
dir.create(d)
old <- setwd(d)
write.csv(iris, file.path(d, "iris.csv"))
write.csv(mtcars, file.path(d, "mtcars.csv"))
write.csv(airquality, file.path(d, "airquality.csv"))
# Add some to a new archive
a <- archive_write_files("data.tar.gz", c("iris.csv", "mtcars.csv"))
setwd(old)
a
# Add all files in a directory
a <- archive_write_dir("data.zip", d)
a
unlink("data.zip")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.