dunif() function in R Language is used to provide the density of the distribution function.
Syntax:
dunif(x, min = 0, max = 1, log = FALSE)Parameters:
x: represents vector
min, max: represents lower and upper limits of the distribution
log: represents logical value for probabilities
Example 1:
# Create vector of random deviation u <- runif(20) dunif(u) == u print(dunif(u)) |
chevron_right
filter_none
Output:
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Example 2:
# Output to be present as PNG file png(file = "dunifGFG.png") # Plot density curve(dunif(x, min = 2, max = 6), 0, 8, ylim = c(0, 0.5), ylab = "f(x)", main = "Uniform Density f(x)") # Saving the file dev.off() |
chevron_right
filter_none
Output:

Recommended Posts:
- Getting Kernel Density Estimates in R Programming - density() Function
- Perform Probability Density Analysis on t-Distribution in R Programming - dt() Function
- Perform the Probability Cumulative Density Analysis on t-Distribution in R Programming - pt() Function
- Perform the Inverse Probability Cumulative Density Analysis on t-Distribution in R Programming - qt() Function
- Compute Randomly Drawn F Density in R Programming - rf() Function
- Compute Chi Square Density in R Programming - dchisq() Function
- Compute Cumulative Chi Square Density in R Programming - pchisq() Function
- Compute Cauchy Density in R Programming - dcauchy() Function
- Compute Cumulative Cauchy Density in R Programming - pcauchy() Function
- Compute Randomly Drawn Chi Square Density in R Programming - rchisq() Function
- Compute Cumulative Logistic Density in R Programming - plogis() Function
- Compute the Logistic Density in R Programming - dlogis() Function
- Compute Randomly Drawn Log Normal Density in R Programming - rlnorm() Function
- Compute Cumulative Log Normal Probability Density in R Programming - plnorm() Function
- Compute Randomly Drawn Cauchy Density in R Programming - rcauchy() Function
- Compute value of Quantile Chi Square Density in R Programming - qchisq() Function
- Compute Log Normal Probability Density in R Programming - dlnorm() Function
- Compute Randomly Drawn Logistic Density in R Programming - rlogis() Function
- Compute the Negative Binomial Density in R Programming - dnbinom() Function
- Compute the Negative Binomial Cumulative Density in R Programming - pnbinom() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

