functions.R 533 B

1234567891011121314151617
  1. # FUNCTION FILE
  2. #
  3. # THIS FILE CONTAINS ALL THE FUNCTIONS THAT MIGTH BE USED GLOBALLY
  4. # specify_decimal. Set how many decimals an number should have
  5. # x => numeric
  6. # k => integer
  7. #
  8. # Returns => numeric with {k} decimals
  9. specify_decimal <- function(x, k) format(round(x, k), nsmall=k)
  10. # consistent. Check if a vactor contains all values between the start and the end
  11. # a => vector containing integers
  12. #
  13. # Returns => bool, true contains all values/ false not
  14. consistent <- function(a) suppressWarnings(all(a == min(a):max(a)))