The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Github: https://github.com/randy3k/collections
Documentation: https://randy3k.github.io/collections/
Provides high performance container data types such as queues, stacks, deques, dicts and ordered dicts. Benchmarks https://randy3k.github.io/collections/articles/benchmark.html have shown that these containers are asymptotically more efficient than those offered by other packages.
You can install the released version of collections from CRAN with:
install.packages("collections")
Install the latest development version using
::install_github("randy3k/collections") devtools
library(collections, warn.conflicts = FALSE)
Queue
<- queue()
q $push(1)$push(2)
q$pop() q
## [1] 1
Stack
<- stack()
s $push(1)$push(2)
s$pop() s
## [1] 2
Deque
<- deque()
dq $push(1)$pushleft(2)
dq$pop() dq
## [1] 1
Priority Queue
<- priority_queue()
pq $push("not_urgent")
pq$push("urgent", priority = 2)
pq$push("not_as_urgent", priority = 1)
pq$pop() pq
## [1] "urgent"
$pop() pq
## [1] "not_as_urgent"
$pop() pq
## [1] "not_urgent"
Dictionary. Comparing to R envrionments, dict()
does not
leak
memory and supports various other types of keys.
<- dict()
d <- new.env()
e $set(e, 1)$set(sum, 2)$set(c(1L, 2L), 3)
d$get(c(1L, 2L)) d
## [1] 3
Ordered Dictionary
<- ordered_dict()
d $set("b", 1)$set("a", 2)
d$as_list() d
## $b
## [1] 1
##
## $a
## [1] 2
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.