Changelog
Source:NEWS.md
Version 1.1.0
Significant Changes
parse_env_subset()onx[NULL]andx[1, NULL]now selects zero elements - it used to select all elements.parse_env_subset()onx[[]],x[[NULL]],x[[integer(0)]]now gives an error as R does for lists - it used to select all elements.
Bug Fixes
Growing a list environment with dimensions, e.g.
length(x) <- n,x[[n]] <- value,x[n] <- value, andx$name <- value, wheren > length(x)ornameis a new element, did not drop the dimensions, as done for lists, which leftxin an invalid state.x[[i, j]]on a list environment with dimensions gave an obscure error when the subscripts referred to more than one element.x[[name]]wherelength(name) != 1gave an obscure error.x[[NA]],x[[NA_integer_]]andx[[NA_real_]]gave an obscure error instead of returningNULL, as done for lists.x[i] <- valuegave an error ificontained zeros, e.g.x[c(0, 2)] <- valueandx[0] <- NULL, instead of ignoring them, as done for lists.x[i] <- valuegave an error ificontained negative indices, e.g.x[-1] <- valueandx[-1] <- NULL, instead of assigning or removing all other elements, as done for lists.x[i]did not handle missing values inias done for lists. For numeric indices, e.g.x[c(1, NA)], it gave an obscure error, and for logical indices, e.g.x[NA]andx[c(TRUE, NA), ], it silently dropped such elements, instead of returningNULLfor them. Similarly,x[i] <- valuedid not ignore missing indices whenvalueis of length one, and did not give an error when it is longer.Subsetting a list environment did not truncate fractional indices toward zero, as done for lists and arrays. For example,
x[-1.5]returned all elements instead of behaving asx[-1], which drops the first element. Similarly,x[1.5, 2.9]behaved asx[1, 3]instead ofx[1, 2].parse_env_subset()onx[[i, j]]with dimensions did not give an error for zero indices, e.g.x[[1, 0]], but returned an empty target, although it gave an error forx[[0]].parse_env_subset()onx[[i, j]]with named dimensions returned elementsidxandexistswith dimnames that should not be there.parse_env_subset()onx[[i, j]]with more or fewer dimensions than subscripts would either give an obscure error or, silently, an incorrect index.parse_env_subset()did not truncate fractional indices, as done for lists and arrays. For example,x[[1.5]]gaveidx = 1.5instead of1, andx[[0.5]]gave an obscure error instead of an error on a zero index.parse_env_subset()would treatx[i]asx["i"], and similarly for more dimensions, e.g.parse_env_subset(x[i, j]).parse_env_subset()onx[names]gave an obscure error whenlength(names) > 1and some names did not exist.parse_env_subset()onx$nameandx[["name"]]would reportexists = TRUEeven ifnamedid not exist inxbut in one of the parent environments.parse_env_subset()treated aNULLsubset as an empty one, e.g.x[NULL]andx[1, NULL]selected all elements instead of none. Also,x[[]],x[[NULL]], andx[[integer(0)]], and similarly for more dimensions, e.g.x[[1, ]], did not give an error, as done for lists and arrays.parse_env_subset("1a", envir = x)gave an error on ‘Not a valid variable name’, although any name is a valid variable name, e.g.x <- listenv("1a" = 1).
Version 0.10.1
CRAN release: 2026-03-10
Bug Fixes
as.list(x[c(n, 2)])on a list environmentxwherenis out of range would return element values in the wrong location.get_variable(x, c(i, j, k, ...))would return the wrong value for list environments with three or more dimensions.as.listenv(x)on a listxwith NULL elements would store them aslist(NULL)instead ofNULL, causingas.list(as.listenv(x))to not be identical tox.as.list(x, all.names = FALSE)on an unnamed list enviromentxwould return an empty list instead of all elements.x[, i] <- NULLon a list environment matrixxwith partial dimnames (some dimensions named, others not) would produce an error.parse_env_subset(x[i, j])would produce an error when the list environmentxhad named elements and a subscript was out of bounds.
Version 0.9.0
CRAN release: 2022-12-16
New Features
parse_env_subset()gained argumentis_variableto control whether or not the inferred element named should be checked if it is a valid variable name.
Version 0.8.0
CRAN release: 2019-12-05
Significant Changes
- S3 method
lengths()forlistenvis no longer exported.
New Features
- Made several error messages more informative. The downside is that those messages are no longer translated (because they are no longer aligned with built-in R error messages which have translations).
Bug Fixes
parse_env_subset(x[1, names])on a listenvxmatrix would throw errorError in if (any(i < 0)) { : missing value where TRUE/FALSE neededif one of the elements innamesspecifies a non-existing column name.parse_env_subset(x[])on a listenvxwould throw an error onInvalid subset: x[].parse_env_subset(x[names])on a listenvxwould throw an error onlength(x) = 2 > 1 in coercion to logical(1)whenlength(names) > 1and_R_CHECK_LENGTH_1_LOGIC2_=true.parse_env_subset(x[1,idxs])on a listenvxwould throw an error onlength(x) = 2 > 1 in coercion to logical(1)withlength(idxs) > 1and_R_CHECK_LENGTH_1_LOGIC2_=true.parse_env_subset(x[[names]])on a regular environmentxwithlength(names) > 1would not throw an error, whereasx[[names]]would.parse_env_subset(x[[1]])on a regular environmentxwould not throw an error, whereasx[[1]]would.
Version 0.7.0
CRAN release: 2018-01-21
New Features
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).Now it is possible to remove multiple elements by assigning NULL, e.g.
x[c(2:3, 10)] <- NULLandx[, "B"] <- NULL.Added
lengths()for list environments. Requires R (>= 3.3.0).dim_na(x) <- dims, wheredimscontain exactly one missing value, will set the “missing” dimension based on the length ofxand the other dimensions specified, e.g. withlength(x) == 6,dim_na(x) <- c(2, NA)will setdim(x) <- c(2, 3). This works for all types of object to which dimensions can be assigned - not only list environments.Added
is.matrix(),is.array(),as.vector(), andas.matrix()for list environments.
Bug Fixes
print()on a named, empty list environment would output an empty string.Removing an element from a list environment did not remove dimensions, e.g.
x$a <- NULL.
Version 0.5.0
CRAN release: 2015-10-31
New Features
Add support for assigning elements when creating list environment similar to how lists work, e.g.
x <- listenv(a = 1, b = 2).length(x) <- nnow expand/truncate a list environment.Added
unlist()andall.equal()for list environments.
Version 0.4.0
CRAN release: 2015-08-08
New Features
Added
as.listenv().CONSISTENCY: Assigning NULL now removes element just as lists, e.g.
x$a <- NULL. To assign value NULL, dox['a'] <- list(NULL).Added support for subsetting with
[(), which returns another list environment, e.g.x[2:3],x[-1], andx[c(TRUE, FALSE)].Added
[<-assignment, e.g.x['a'] <- 1andx[2:3] <- c(3,8).CLEANUP: Dropped stray debug code.
Version 0.2.4
New Features
- Added helper function
parse_env_subset().
Version 0.2.3
New Features
-
print()onlistenvhandles empty and no-namedlistenv:s better.
Version 0.2.1
New Features
-
get_variable()gained argumentmustExist.
Version 0.1.4
New Features
- Added
print()forlistenv:s.