size {datastructures}R Documentation

Get the size of an object

Description

Computes the size of an object, i.e. the number of keys or <key, value> pairs depending on the object.

Usage

size(obj)

## S4 method for signature 'deque'
size(obj)

## S4 method for signature 'heap'
size(obj)

## S4 method for signature 'map'
size(obj)

Arguments

obj

the object to get the size from

Value

returns the size of obj

Examples


 # get the size of a hashmap
 h_map <- hashmap()
 h_map[letters] <- rnorm(length(letters))
 size(h_map)

 # get the size of a fibonacci heap
 f_heap <- fibonacci_heap()
 f_heap <- insert(f_heap, letters[seq(3)], list(1, diag(3), rnorm(2)))
 size(f_heap)

 # get the size of a stack
 s <- stack()
 s <- insert(s, list(1))
 size(s)


[Package datastructures version 0.2.8 Index]