Skip to content

Instantly share code, notes, and snippets.

@jonesor
Last active July 18, 2026 19:58
Show Gist options
  • Select an option

  • Save jonesor/4210128 to your computer and use it in GitHub Desktop.

Select an option

Save jonesor/4210128 to your computer and use it in GitHub Desktop.
R function to round up to a number divisible by n.
# Round x up to the nearest multiple of n.
roundup <- function(x, n){ceiling(x / n) * n}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment