An open API service indexing awesome lists of open source software.

https://github.com/petermeissner/wayback

#rstats package to handle package installations on legacy #rstats systems
https://github.com/petermeissner/wayback

Last synced: 3 months ago
JSON representation

#rstats package to handle package installations on legacy #rstats systems

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r scaffolding options, include=FALSE}
github_user_name <- "petermeissner"
codecov_user_name <- github_user_name
travis_user_name <- github_user_name
appveyor_user_name <- github_user_name
```

```{r knitr options, echo = FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/README-"
)
```

```{r r options, include=FALSE}
options("width"=110)

# get package info
tmp <- packageDescription( "wayback" )
#tmp <- packageDescription( basename(getwd()) )

package_name <- tmp$Package

```

```{r readme title, results='asis', echo=FALSE}
cat("#", tmp$Title)
```

**Status**


[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/`r github_user_name`/`r package_name`?branch=master&svg=true)](https://ci.appveyor.com/project/`r github_user_name`/`r package_name`)
Codecov

```{r, include=FALSE}
filelist.R <- list.files("R", recursive = TRUE, pattern="\\.R$", ignore.case = TRUE, full.names = TRUE)
filelist.tests <- list.files("tests", recursive = TRUE, pattern="\\.R$", ignore.case = TRUE, full.names = TRUE)
filelist.cpp <- list.files("src", recursive = TRUE, pattern="\\.cpp$", ignore.case = TRUE, full.names = TRUE)
lines.R <- unlist(lapply(filelist.R, readLines))
lines.tests <- unlist(lapply(filelist.tests, readLines))
lines.cpp <- unlist(lapply(filelist.cpp, readLines))
length.R <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.R, value = TRUE, invert = TRUE))
length.tests <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.tests, value = TRUE, invert = TRUE))
length.cpp <- length(grep("(^\\s*$)|(^\\s*#)|(^\\s*//)", lines.cpp, value = TRUE, invert = TRUE))
```

*lines of R code:* `r length.R`, *lines of test code:* `r length.tests`

**Version**

```{r, include=FALSE}
source_files <-
grep(
"/R/|/src/|/tests/",
list.files(recursive = TRUE, full.names = TRUE),
value = TRUE
)
last_change <-
as.character(
format(max(file.info(source_files)$mtime), tz="UTC")
)
```

```{r, results='asis', echo=FALSE}
cat(tmp$Version, "(",last_change,")")
```

**Description**

```{r, results='asis', echo=FALSE}
cat(tmp$Description)
```

**License**

```{r, results='asis', echo=FALSE}
cat(tmp$License, "
")
cat(tmp$Author)
```

**Citation**

```{r, results='asis', echo=FALSE}
cat("```r\n")
cat("citation(\"",package_name,"\")", sep = "")
cat("\n```\n")
```

```{r, results='asis', echo=FALSE}
cat("```r\n")
print_text <- capture.output(print(citation(package_name), style = "text"))
cat(gsub("_", "", print_text))
cat("\n```\n")
```

**BibTeX for citing**

```{r, results='asis', echo=FALSE}
cat("```r\n")
cat("BibTeX(citation(\"",package_name,"\"))", sep = "")
cat("\n```\n")
```

```{r, results='asis', echo=FALSE}
cat("```\n")
cat(as.character(toBibtex(citation(package_name))), sep = "\n")
cat("\n```\n")
```

**Installation**

Stable version from CRAN:

```{r, results='asis', echo=FALSE}
cat("```r\n")
cat("install.packages(\"",package_name,"\")", sep = "")
cat("\n```\n")
```

## Package Usage

```{r}
library(wayback)
```

The main function of the package is `wb_require()`. Once `{wayback}` is installed this function
allows to have required packages loaded from a library specified. In addition `wb_require()` will
install packages that are not present but required.

The real core strength and purpose of the package is to install packages and dependencies from
a specific point in time. This is provided by the `date` parameter allowing to go back in time -
especially to a point in time where known to have consistent states of packages and dependencies
for a given version of R.

```{r}
suppressPackageStartupMessages(
wb_require(
pkg = "glue",
date = Sys.Date(),
library_path = "./r_package_library"
)
)
```

```{r}
info <- packageDescription("glue", lib.loc = "./r_package_library")

info$Packaged
```

## Package Use Cases and Scope

## Package Maxims and Trade Offs

- given `{wayback}` is installed everything else should just work
- `{wayback}` will not change how your session works - e.g. normal `install.packages()` will work the same with and without `{wayback}`
- given that no date is provided the parameter `date` will default to 60 days after the currently used R version's publication date
- `{wayback}` will not install anything if the required package is already found in the current path
- if however a explicit library path is provided - best practice - than `{wayback}` will assume that all packages and all dependencies - except base R packages - should come from this source
- dependencies are important: `{wayback}` will forcefully install dependencies
- providing a function that does package loading and installation is less 'save' than the standard usage of `library()` on the other hand this is common practice and `{wayback}` scratches this itch in hope to provide a solid, effective and robust solution to the problem
- behaviour should - by default - stem from function parameters only
- to minimize re-writing function parameters over and over again all function parameters can be set via options

## Other Packages and Frameworks