compute_count_vec: Count unique observations (vector).

Description Usage Arguments Value Examples

View source: R/count.R

Description

This function is very similar to table except that: it counts missing values if present, can use weights, only does 1d, returns a 2 column data frame instead of a named vector, and is much much faster.

Usage

1

Arguments

x

A logical vector, a factor, a double or integer vector (or S3 object with restore() method), or a character vector.

w

Optionally, a vector of weights. If present, weights are summed instead of counting observations. In other words, the default behaviour is to assign weight 1 to each point.

Value

A data frame with columns:

x_

value (same type as x)

count_

number of observations/sum of weights (numeric)

Examples

1
2

hadley/ggstat documentation built on May 17, 2019, 10:40 a.m.