Environments Behaving (Almost) as Lists

List environments are environments that have list-like properties. For instance, the elements of a list environment are ordered and can be accessed and iterated over using index subsetting, e.g. 'x <- listenv(a = 1, b = 2); for (i in seq_along(x)) x[[i]] <- x[[i]] ^ 2; y <- as.list(x)'.


News

Package: listenv

Version: 0.7.0 [2018-01-21]

NEW FEATURES:

o Now it is possible to set the dimension on an empty list environment without first resizing it with length(), e.g. x <- listenv(); dim(x) <- c(2, 3).

o Now it is possible to remove multiple elements by assigning NULL, e.g. x[c(2:3, 10)] <- NULL and x[, "B"] <- NULL.

o Added lengths() for list environments. Requires R (>= 3.3.0).

o dim_na(x) <- dims, where 'dims' contain exactly one missing value, will set the "missing" dimension based on the length of 'x' and the other dimensions specified, e.g. with length(x) == 6, dim_na(x) <- c(2, NA) will set dim(x) <- c(2, 3). This works for all types of object to which dimensions can be assigned - not only list environments.

o Added is.matrix(), is.array(), as.vector() and as.matrix() for list environments.

BUG FIXES:

o print() on a named, empty list environment would output an empty string.

o Removing an element from a list environment did not remove dimensions, e.g. x$a <- NULL.

DEPRECATED AND DEFUNCT:

o Function map() has been renamed to mapping() and same for the corresponding replacement function. The map() and map<-() functions will soon be deprecated and eventually defunct.

o x <- listenv(length = n) is defunct; use x <- listenv(); length(x) <- n.

Version: 0.6.0 [2015-12-27]

NEW FEATURES:

o Added support for multi-dimensional subsetting of list environments just as for list.

BUG FIXES:

o parse_env_subset(x[[idx]]) for list environment 'x' and index 'idx' claimed x[[idx]] exists as long as idx in [1,length(x)] but it forgot to check if element really existed, which may not be true if 'x' has been expanded.

Version: 0.5.0 [2015-10-30]

NEW FEATURES:

o Add support for assigning elements when creating list environment similarly how to lists work, e.g. x <- listenv(a = 1, b = 2).

o length(x) <- n now expand/truncate a list environment.

o Added unlist() and all.equal() for list environments.

DEPRECATED AND DEFUNCT:

o Deprecated x <- listenv(length = n); use x <- listenv(); length(x) <- n.

BUG FIXES:

o as.listenv(x) would drop NULL elements in 'x'.

o x[idxs], x[name] <- y and x$ <- y would introduce NA names for non-named list environments.

Version: 0.4.0 [2015-08-08]

NEW FEATURES:

o Added as.listenv().

o CONSISTENCY: Assigning NULL now removes element just as lists, e.g. x$a <- NULL. To assign value NULL, do x['a'] <- list(NULL).

o Added support for subsetting with [(), which returns another list environment, e.g. x[2:3], x[-1] and x[c(TRUE, FALSE)].

o Added [<- assignment, e.g. x['a'] <- 1 and x[2:3] <- c(3,8).

o CLEANUP: Dropped stray debug code.

Version: 0.3.0 [2015-05-23]

CODE REFACTORIZATION:

o Package no longer depends on other packages.

Version: 0.2.4 [2015-05-22]

NEW FEATURES:

o Added helper function parse_env_subset().

Version: 0.2.3 [2015-05-21]

NEW FEATURES:

o print() on listenv() handles empty and no-named listenv:s better.

Version: 0.2.2 [2015-05-20]

NEW FEATURES:

o Now listenv(length = ...) always allocates internal variables.

Version: 0.2.1 [2015-05-19]

NEW FEATURES:

o get_variable() gained argument 'mustExist'.

Version: 0.2.0 [2015-05-19]

SIGNFICANT CHANGES:

o Moved list environments from an in-house package to its own package.

Version: 0.1.4 [2015-05-02]

NEW FEATURES:

o Added print() for listenv:s.

CODE REFACTORIZATION:

o Using tempvar() of R.utils.

Version: 0.1.0 [2015-02-07]

o Created.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("listenv")

0.8.0 by Henrik Bengtsson, 2 years ago


https://github.com/HenrikBengtsson/listenv


Report a bug at https://github.com/HenrikBengtsson/listenv/issues


Browse source code at https://github.com/cran/listenv


Authors: Henrik Bengtsson [aut, cre, cph]


Documentation:   PDF Manual  


LGPL (>= 2.1) license


Suggests R.utils, R.rsp, markdown


Imported by PSCBS, aroma.affymetrix, aroma.core, future, greed, origami.

Suggested by PCRedux, furrr, future.apply, future.batchtools, future.callr.


See at CRAN