Computes the mean of a sparse_numeric vector, including all the zeros.

# S4 method for class 'sparse_numeric'
mean(x, ...)

Arguments

x

A sparse_numeric object.

...

Additional arguments.

Value

A numeric scalar representing the mean.

Examples

x <- new("sparse_numeric", value = c(1, 2), pos = c(2L, 5L), length = 6L)
mean(x)
#> [1] 0.5