Convert a normal (gaussian) distribution to a truncated normal distribution with specified minimum and maximum
the normally distributed vector
the minimum of the truncated distribution to return
the maximum of the truncated distribution to return
the mean of the distribution to return (calculated from x if not given)
the SD of the distribution to return (calculated from x if not given)
the mean of x (calculated from x if not given)
the SD of x (calculated from x if not given)
a vector with a uniform distribution
x <- rnorm(10000)
y <- norm2trunc(x, 1, 7, 3.5, 2)
g <- ggplot2::ggplot() + ggplot2::geom_point(ggplot2::aes(x, y))
ggExtra::ggMarginal(g, type = "histogram")