Skip to content

Commit

Permalink
fix #17
Browse files Browse the repository at this point in the history
  • Loading branch information
mllg committed Feb 6, 2019
1 parent 664eb6f commit afb60e1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/named_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @examples
#' named_list(c("a", "b"))
#' named_list(c("a", "b"), init = 1)
named_list = function(nn, init = NULL) {
named_list = function(nn = character(0L), init = NULL) {
assert_character(nn, any.missing = FALSE)
x = vector("list", length(nn))
if (!is.null(init))
Expand Down
3 changes: 1 addition & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#' @rawNamespace import(data.table, except = transpose)
#' @import checkmate
#' @importFrom utils head
#' @importFrom utils head adist
#' @importFrom stats setNames
#' @importFrom utils adist
NULL

.onLoad = function(libname, pkgname) { #nocov start
Expand Down
2 changes: 1 addition & 1 deletion man/named_list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/testthat/test_named_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ context("named_list")

test_that("named_list", {
expect_equal(named_list(character()), setNames(vector("list", 0), nm = character()))
expect_equal(named_list(), setNames(vector("list", 0), nm = character()))
expect_equal(named_list("a"), list(a=NULL))
expect_equal(named_list(c("a", "b")), list(a=NULL, b=NULL))
expect_equal(named_list(c("a", "b"), 1), list(a=1, b=1))
Expand Down

0 comments on commit afb60e1

Please sign in to comment.