The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
pkglite
offers a solution for converting R package
source code to a compact, text-based representation and restore the
source package structure from the representation. There are three
specific aims:
To achieve these goals, we developed a pipe-friendly workflow, the
concept of file specifications and file collections, and a format
specification for the output file pkglite.txt
. These
designs allow us to leave a clear and skimmable trace in the code when
generating such compact representations, thus improves
reproducibility.
To demonstrate the basic usage of pkglite, we will show how to pack and unpack one or multiple R packages.
First, locate the input package directory and the output file:
Use the following chain of calls to pack a default set of files in
the R package under directory pkg
into the file
txt
:
The collate()
function evaluates one or more
file specifications to generate a file
collection. They fully determine the scope of the files to pack
here. For details, check
vignette("filespec", package = "pkglite")
.
Check the first lines of the output file:
txt %>%
readLines() %>%
head(11) %>%
cat(sep = "\n")
#> # Generated by pkglite: do not edit by hand
#> # Use pkglite::unpack() to restore the packages
#>
#> Package: pkg1
#> File: DESCRIPTION
#> Format: text
#> Content:
#> Package: pkg1
#> Type: Package
#> Title: Example Package One
#> Version: 0.1.0
Check the number of lines the output file:
To unpack (restore) the file structures from the text file, use
unpack()
:
This will create a directory named after the R package under the output directory:
out %>%
file.path("pkg1") %>%
list.files()
#> [1] "DESCRIPTION" "NAMESPACE" "NEWS.md" "R" "README.md"
#> [6] "data" "man" "vignettes"
To install the packages after unpacking them, use
unpack(..., install = TRUE)
.
pack()
accepts one or more input directories. Therefore,
one can pack multiple R packages (file collections) into one file at
once:
pkg1 <- system.file("examples/pkg1", package = "pkglite")
pkg2 <- system.file("examples/pkg2", package = "pkglite")
fc1 <- pkg1 %>% collate(file_default())
fc2 <- pkg2 %>% collate(file_default())
pack(fc1, fc2, output = txt, quiet = TRUE)
Since the two example packages have almost identical content, the number of lines in the text file is doubled here (three header lines excluded):
Use the same call to unpack (and install) multiple R packages from the text file:
out %>%
file.path("pkg1") %>%
list.files()
#> [1] "DESCRIPTION" "NAMESPACE" "NEWS.md" "R" "README.md"
#> [6] "data" "man" "vignettes"
out %>%
file.path("pkg2") %>%
list.files()
#> [1] "DESCRIPTION" "NAMESPACE" "NEWS.md" "R" "README.md"
#> [6] "data" "man" "vignettes"
The file format specification for pkglite.txt
is
described in vignette("format", package = "pkglite")
.
Verify if the text file contains only ASCII characters:
Remove lines of file content from the text file:
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.