mirror of
https://github.com/dchakro/shared_Rscripts.git
synced 2026-05-17 09:12:16 -07:00
Add website URL
This commit is contained in:
parent
db75cd3575
commit
03836a5c29
8 changed files with 50 additions and 42 deletions
41
roundUp.R
41
roundUp.R
|
|
@ -1,28 +1,29 @@
|
|||
roundUp <- function(x,to=10)
|
||||
{
|
||||
# #<---------------------------->
|
||||
# # You must include this section when:
|
||||
# # Distributing, Using and/or Modifying this code.
|
||||
# # Please read and abide by the terms of the included LICENSE.
|
||||
# # Copyright 2018, Deepankar Chakroborty, All rights reserved.
|
||||
# # You must include this section when:
|
||||
# # Distributing, Using and/or Modifying this code.
|
||||
# # Please read and abide by the terms of the included LICENSE.
|
||||
# # Copyright 2018, Deepankar Chakroborty, All rights reserved.
|
||||
|
||||
# # Author : Deepankar Chakroborty (https://github.com/dchakro)
|
||||
# # Report issues: https://github.com/dchakro/shared_Rscripts/issues
|
||||
# # License: https://github.com/dchakro/shared_Rscripts/blob/master/LICENSE
|
||||
# # Author : Deepankar Chakroborty (https://github.com/dchakro)
|
||||
# # Report issues: https://github.com/dchakro/shared_Rscripts/issues
|
||||
# # Website: https://www.dchakro.com
|
||||
# # License: https://github.com/dchakro/shared_Rscripts/blob/master/LICENSE
|
||||
|
||||
# # Adapted from: https://stackoverflow.com/a/44691056
|
||||
|
||||
# # PURPOSE:
|
||||
# # This function takes in single number as input and rounds it
|
||||
# # to the nearest tenth by default. e.g. 7 would be rounded to 10.
|
||||
|
||||
# # PARAMETERS
|
||||
# # x : The integer to be rounded
|
||||
# # to: nearest place to round to
|
||||
|
||||
# # EXAMPLES
|
||||
# roundUp(465,20) would give 480
|
||||
# roundUp(462,5) would give 465
|
||||
# # Adapted from: https://stackoverflow.com/a/44691056
|
||||
|
||||
# # PURPOSE:
|
||||
# # This function takes in single number as input and rounds it
|
||||
# # to the nearest tenth by default. e.g. 7 would be rounded to 10.
|
||||
|
||||
# # PARAMETERS
|
||||
# # x : The integer to be rounded
|
||||
# # to: nearest place to round to
|
||||
|
||||
# # EXAMPLES
|
||||
# roundUp(465,20) would give 480
|
||||
# roundUp(462,5) would give 465
|
||||
|
||||
to*(x%/%to + as.logical(x%%to))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue