-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from kimsjune/add_archive_support
Add archive support
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
set -e | ||
|
||
apt-get update -qq | ||
apt-get install libarchive-dev | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
options(download.file.method="curl") | ||
install.packages("archive", repos = "https://cran.rstudio.com") | ||
library(archive) | ||
|
||
|
||
## https://archive.r-lib.org/reference/archive_write_files.html | ||
|
||
# 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") |