Learn R Programming

HistDat (version 0.2.0)

as.vector,HistDat-method: Converts this histogram to a vector. Not recommended if there are many counts as this would result in an incredibly long vector

Description

Converts this histogram to a vector. Not recommended if there are many counts as this would result in an incredibly long vector

Usage

# S4 method for HistDat
as.vector(x)

Arguments

x

An instance of the class HistDat

Value

A vector with the same length as x, but as a 1-D vector with an element for each count in the counts vector. In other words, all length(x) observations will be represented as a single element instead of being just counted as in the original HistDat object.

Examples

Run this code
# NOT RUN {
hd <- HistDat(vals = 1:3, counts = c(1, 2, 1))
as.vector(hd) # returns 1 2 2 3
# }

Run the code above in your browser using DataLab