HughParsonage / hutils

Compare e80afed ... +0 ... c594cb8

Showing 1 of 1 files from the diff.

@@ -47,33 +47,6 @@
Loading
47 47
#' @rdname bearing
48 48
#' @export
49 49
compass2bearing <- function(compass) {
50 -
  if (length(compass) > 1) {
51 -
    x <- res <- NULL
52 -
    DT <- setDT(list(x = compass))
53 -
    DT[, res := compass2bearing(x), by = "x"]
54 -
    return(.subset2(DT, "res"))
55 -
  }
56 -
  if (is.na(compass)) {
57 -
    return(NA_real_)
58 -
  }
59 -
  
60 -
  switch(nchar(compass),
61 -
         {
62 -
           c(0, 90, 180, 270)[match(toupper(compass), c("N", "E", "S", "W"))]
63 -
         },
64 -
         {
65 -
           c(45, 135, 225, 315)[match(toupper(compass), c("NE", "SE", "SW", "NW"))]
66 -
         },
67 -
         {
68 -
           b1 <- substr(compass, 0, 1)
69 -
           b2 <- substr(compass, 2, 3)
70 -
           average_bearing(compass2bearing(b1),
71 -
                           compass2bearing(b2))
72 -
         },
73 -
         0)
74 -
}
75 -
76 -
.compass2bearing <- function(compass) {
77 50
  CompassNames <- c("CALM", 
78 51
                    "E", "ENE", "ESE",
79 52
                    "N",

Learn more Showing 1 files with coverage changes found.

Changes in R/bearing.R
-13
+13
Loading file...
Files Coverage
Project Totals (53 files) 99.60%
Loading