R/general_functions.R

Defines functions degree_to_cardinal mround

degree_to_cardinal <- function(deg){
    val <- as.integer((deg/22.5) + .5)
    cardinal_index <- c("N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", 
                        "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW")
    cardinal_index[(val %% 16) + 1]
}

mround <- function(x, base){
  base * round(x/base)
}
jwbannister/aiRsci documentation built on May 7, 2019, 8:02 a.m.