relative_freq: compute relative frequency

Description Usage Arguments Details Value Author(s) Examples

View source: R/relative_freq.R

Description

A function to comoute relative frequency efficiently

Usage

1
relative_freq(bin_idx = 1L, h_breaks = 20L, obs)

Arguments

bin_idx

Integer, bin number of the histogram

h_breaks

number of breaks for the histogram

obs

A numeric vector of observations

Details

This function compute relative frequency effectively using tabulate

Value

rf A numerical vector of the relative frequencies rf_one A numerical value of the relative frequency of a particular bin

Author(s)

Mohamad S. Hasan, mshasan@uga.edu

Examples

1
2
3
# generating data (known in practice)
X = runif(1000, min = 0, max = 2)         # covariate
r_freq <- relative_freq(bin_idx = 1, h_breaks = 20, obs = X)

mshasan/empOPW documentation built on March 1, 2021, 4:19 a.m.