R/golden_ratio.R

Defines functions golden_ratio

Documented in golden_ratio

#' Golden Ratio
#'
#' Returns the golden ratio (1.618034...). Useful to easily obtain golden
#' proportions, for instance for a horizontal figure, if you want its height to
#' be 8, you can set its width to be `golden_ratio(8)`.
#'
#' @param x A number to be multiplied by the golden ratio. The default (`x = 1`)
#'   returns the value of the golden ratio.
#'
#' @examples
#' golden_ratio()
#' golden_ratio(10)
#' @export
golden_ratio <- function(x = 1) {
  x * (1 + sqrt(5)) / 2
}

Try the see package in your browser

Any scripts or data that you put into this service are public.

see documentation built on Nov. 3, 2023, 5:10 p.m.