Learn R Programming

exams.forge (version 1.0.10)

ddiscrete: Discrete Probability Function

Description

Creates a discrete probability function based on x with a resolution unit. If unit is not given then unit will be 10, 100, 1000, ... depending on the length of the discrete probability function.

Usage

ddiscrete(x, unit = NULL, zero = FALSE)

Value

A discrete probability function.

Arguments

x

numeric: number of elements of vector of initial probabilities

unit

integer: reciprocal of the smallest non-zero probability (default: NULL)

zero

logical: zeros are allowed in the final probabilities (default: FALSE)

Examples

Run this code
ddiscrete(runif(6))
ddiscrete(6)
ddiscrete(6, 20)
ddiscrete(c(1,0,0,0), zero=TRUE)

Run the code above in your browser using DataLab