Commit f4007491 authored by Andreas Tille's avatar Andreas Tille

New upstream version 0.1.1

parents
Package: zeligverse
Type: Package
Title: Easily Install and Load Stable Zelig Packages
Version: 0.1.1
Date: 2017-05-17
Authors@R: c(
person("Christopher", "Gandrud", email = "zelig.zee@gmail.com",
role = c("aut", "cre"))
)
Description: Provides an easy way to load stable Core Zelig and ancillary Zelig
packages.
License: GPL (>= 3)
Encoding: UTF-8
Imports: Amelia, dplyr, MatchIt, purrr, rstudioapi, tibble, WhatIf,
Zelig, ZeligChoice, ZeligEI
URL: https://github.com/IQSS/zeligverse
BugReports: https://github.com/IQSS/zeligverse/issues
LazyData: true
RoxygenNote: 6.0.1
Suggests: testthat
NeedsCompilation: no
Packaged: 2017-05-17 17:30:41 UTC; cgandrud
Author: Christopher Gandrud [aut, cre]
Maintainer: Christopher Gandrud <zelig.zee@gmail.com>
Repository: CRAN
Date/Publication: 2017-05-17 17:45:44 UTC
1060ed7448c072d55504837bdd835046 *DESCRIPTION
431a661dc94e5e5fa94f2442584e4f51 *NAMESPACE
7da6a9ed86e2dcd67190a61ee8de4bbb *NEWS.md
8ec63919ede3dd51a4ebcf1da5ca41d8 *R/attach.R
92dafd3f92588a7346b182dfd4063051 *R/update.R
03293a0f693983a2e4d812239d1bba1f *R/utils.R
a3e88fd0713ea52ab550a29ddab400af *R/zeligverse.R
b5dd606ab2ff3283d69c585ee4e0eda6 *R/zzz.R
04c6c4f4f1e107bc8928dc860bb17b13 *README.md
0c6df7a3fd72f6356621bafc6c775f8e *man/figures/zelig.png
9ee4b9ca48878fb0a5797f5091d30e75 *man/zeligverse-package.Rd
5ba18081208a2b008d41496cb0b3f04e *man/zeligverse_deps.Rd
d6d6ad42b7dc3837962ab13f47694f20 *man/zeligverse_update.Rd
014c0a17870caab854fcac18a03582e4 *tests/testthat.R
5355c357c88fcc2e0958aaafe2b9bc07 *tests/testthat/test-attach.R
# Generated by roxygen2: do not edit by hand
export(zeligverse_deps)
export(zeligverse_update)
import(ZeligChoice)
import(ZeligEI)
importFrom(Zelig,zelig)
importFrom(dplyr,"%>%")
importFrom(dplyr,filter)
importFrom(purrr,map2_lgl)
importFrom(purrr,map_chr)
importFrom(rstudioapi,getVersion)
importFrom(rstudioapi,isAvailable)
importFrom(tibble,tibble)
importFrom(tools,package_dependencies)
importFrom(utils,available.packages)
# zeligverse 0.1.1
* Added Amelia, MatchIt, and WhatIf packages.
# zeligverse 0.1.0
* Initial release. On load, zeligverse loads (core) Zelig, ZeligEI, and
ZeligChoice.
#' @source tidyverse
#' @keywords internal
## Add zeligverse modules here and in the DESCRIPTION Imports ##
core <- c('Zelig', 'ZeligChoice', 'ZeligEI', 'Amelia', 'MatchIt', 'WhatIf')
zeligverse_attach <- function() {
versions <- vapply(core, function(x) as.character(utils::packageVersion(x)),
character(1))
packages <- paste0("+ ", format(core), " ", format(versions))
if (length(packages) < 6) {
packages <- c(packages, rep(' ',
6 - length(packages)))
}
info <- platform_info()
info <- paste0(format(paste0(names(info)), justify = "right"), ": ", info)
n <- max(length(packages), length(info))
info <- c(info, rep("", n - length(info)))
info <- paste0(packages, " ", info, collapse = "\n")
startup_message(info)
suppressPackageStartupMessages(
lapply(core, library, character.only = TRUE, warn.conflicts = FALSE)
)
invisible()
}
#' @importFrom rstudioapi getVersion isAvailable
#' @source tidyverse
#' @keywords internal
platform_info <- function() {
if (rstudioapi::isAvailable()) {
ver <- rstudioapi::getVersion()
ui <- paste0("RStudio ", ver, "")
} else {
ui <- .Platform$GUI
}
ver <- R.version
c(
Date = format(Sys.Date()),
R = paste0(ver$major, ".", ver$minor),
OS = os(),
GUI = ui,
Locale = Sys.getlocale("LC_COLLATE"),
TZ = Sys.timezone()
)
}
#' @source tidyverse
#' @keywords internal
os <- function() {
x <- utils::sessionInfo()$running
# Regexps to clean up long windows strings generated at
# https://github.com/wch/r-source/blob/af7f52f70101960861e5d995d3a4bec010bc89e6/src/library/utils/src/windows/util.c
x <- gsub("Service Pack", "SP", x)
x <- gsub(" [(]build \\d+[)]", "", x)
x
}
#' Update zeligverse packages
#'
#' This will check to see if all zeligverse packages (and optionally, their
#' dependencies) are up-to-date, and will install after an interactive
#' confirmation.
#'
#' @param recursive If \code{TRUE}, will also check all dependencies of
#' zeligverse packages.
#'
#' @importFrom dplyr filter
#' @export
#' @source tidyverse
#' @examples
#' \dontrun{
#' zeligverse_update()
#' }
zeligverse_update <- function(recursive = FALSE) {
deps <- zeligverse_deps(recursive)
behind <- dplyr::filter(deps, behind)
if (nrow(behind) == 0) {
message("All zeligverse packages up-to-date")
return(invisible())
}
message("The following packages are out of date:")
bullets(format(behind$package), " (", behind$local, " -> ", behind$cran, ")")
message("Update now?")
do_it <- utils::menu(c("Yes", "No")) == 1
if (!do_it) {
return(invisible())
}
utils::install.packages(
behind$package,
quiet = TRUE,
dependencies = if (recursive) FALSE else NA
)
invisible()
}
#' List all zeligverse dependencies
#'
#' @param recursive If \code{TRUE}, will also list all dependencies of
#' zeligverse packages.
#' @source tidyverse
#'
#' @importFrom dplyr %>%
#' @importFrom purrr map2_lgl map_chr
#' @importFrom tibble tibble
#' @importFrom utils available.packages
#' @importFrom tools package_dependencies
#' @export
zeligverse_deps <- function(recursive = FALSE) {
pkgs <- available.packages()
deps <- tools::package_dependencies("zeligverse", pkgs,
recursive = recursive)
pkg_deps <- unique(sort(unlist(deps)))
base_pkgs <- c(
"base", "compiler", "datasets", "graphics", "grDevices", "grid",
"methods", "parallel", "splines", "stats", "stats4", "tools", "tcltk",
"utils"
)
pkg_deps <- setdiff(pkg_deps, base_pkgs)
cran_version <- lapply(pkgs[pkg_deps, "Version"], package_version)
local_version <- lapply(pkg_deps, utils::packageVersion)
behind <- purrr::map2_lgl(cran_version, local_version, `>`)
tibble::tibble(
package = pkg_deps,
cran = cran_version %>% purrr::map_chr(as.character),
local = local_version %>% purrr::map_chr(as.character),
behind = behind
)
}
#' @source tidyverse
#' @keywords internal
startup_message <- function(...) {
if (isTRUE(getOption("tidyverse.quiet")))
return()
packageStartupMessage(...)
}
#' @source tidyverse
#' @keywords internal
bullets <- function(...) {
message(paste0(" * ", ..., collapse = "\n"))
}
#' @keywords internal
"_PACKAGE"
# Suppress R CMD check note
#' @importFrom Zelig zelig
#' @import ZeligChoice
#' @import ZeligEI
NULL
.onAttach <- function(...) {
needed <- core[!is_attached(core)]
if (length(needed) == 0)
return()
zeligverse_attach()
# tidyverse_conflicts()
}
is_attached <- function(x) {
paste0("package:", x) %in% search()
}
<!-- README.md is generated from README.Rmd. Please edit that file -->
[![zelig-logo](man/figures/zelig.png)](http://zeligproject.org)
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/zeligverse)](https://cran.r-project.org/package=zeligverse) [![Travis-CI Build Status](https://travis-ci.org/IQSS/zeligverse.svg?branch=master)](https://travis-ci.org/IQSS/zeligverse) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/IQSS/zeligverse?branch=master&svg=true)](https://ci.appveyor.com/project/IQSS/zeligverse)
About
=====
This package makes it convenient to install and load all of the stable Zelig packages. This includes:
- [Zelig](https://github.com/IQSS/Zelig)
- [ZeligChoice](https://github.com/IQSS/ZeligChoice)
- [ZeligEI](https://github.com/IQSS/ZeligEI)
- [Amelia](https://gking.harvard.edu/amelia)
- [MatchIt](https://gking.harvard.edu/matchit)
- [WhatIf](https://gking.harvard.edu/whatif)
Use
===
To use **zeligverse**, simply load the package:
``` r
library(zeligverse)
```
## + Zelig 5.1.1.90000 Date: 2017-05-17
## + ZeligChoice 0.9.5.90000 R: 3.4.0
## + ZeligEI 0.1.1 OS: macOS Sierra 10.12.5
## + Amelia 1.7.4 GUI: unknown
## + MatchIt 3.0.1 Locale: en_US.UTF-8
## + WhatIf 1.5.8 TZ: America/New_York
As you can see, all of the stable Zelig packages are loaded.
Installing **zeligverse** will install these packages.
Adding packages \[for developers\]
==================================
**zeligverse** developers can add packages to **zeligverse** by:
- adding the package name to the *DESCRIPTION* `Imports`
- adding the package name to the `core` object in *attach.R*
Inspiration
===========
The inspiration (and much of the underlying code) for **zeligverse** comes from the [tidyverse](http://tidyverse.org/) package.
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/zeligverse.R
\docType{package}
\name{zeligverse-package}
\alias{zeligverse}
\alias{zeligverse-package}
\title{zeligverse: Easily Install and Load Stable Zelig Packages}
\description{
Provides an easy way to load stable Core Zelig and ancillary Zelig
packages.
}
\seealso{
Useful links:
\itemize{
\item \url{https://github.com/IQSS/zeligverse}
\item Report bugs at \url{https://github.com/IQSS/zeligverse/issues}
}
}
\author{
\strong{Maintainer}: Christopher Gandrud \email{zelig.zee@gmail.com}
}
\keyword{internal}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update.R
\name{zeligverse_deps}
\alias{zeligverse_deps}
\title{List all zeligverse dependencies}
\source{
tidyverse
}
\usage{
zeligverse_deps(recursive = FALSE)
}
\arguments{
\item{recursive}{If \code{TRUE}, will also list all dependencies of
zeligverse packages.}
}
\description{
List all zeligverse dependencies
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/update.R
\name{zeligverse_update}
\alias{zeligverse_update}
\title{Update zeligverse packages}
\source{
tidyverse
}
\usage{
zeligverse_update(recursive = FALSE)
}
\arguments{
\item{recursive}{If \code{TRUE}, will also check all dependencies of
zeligverse packages.}
}
\description{
This will check to see if all zeligverse packages (and optionally, their
dependencies) are up-to-date, and will install after an interactive
confirmation.
}
\examples{
\dontrun{
zeligverse_update()
}
}
library(testthat)
library(zeligverse)
test_check("zeligverse")
# REQUIRE TEST required Zelig packages load ------------------------------------
test_that("REQUIRE TEST required Zelig packages load", {
library(zeligverse)
zelig_pkgs <- c('package:zeligverse', 'package:Zelig', 'package:ZeligEI',
'package:ZeligChoice')
expect_true(all(zelig_pkgs %in% search()))
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment