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
Mode.R 100.00%
RQ.R 100.00%
Switch.R 100.00%
aliases.R 100.00%
all_same_sign.R 100.00%
any_grepl.R 100.00%
auc.R 100.00%
average_bearing.R 100.00%
bearing.R +43.14% 100.00%
coalesce.R 100.00%
dev_copy2a4.R 90.91%
dir2.R 100.00%
drop_col.R 100.00%
drop_colr.R 100.00%
drop_constant_cols.R 100.00%
drop_empty_cols.R 100.00%
duplicated_rows.R 100.00%
ein.R 100.00%
find_pattern.R 100.00%
generate_LaTeX_manual.R 100.00%
haversine_distance.R 100.00%
hull.R 100.00%
if_else.R 100.00%
implies.R 100.00%
isAttached.R 100.00%
isTrueFalse.R 100.00%
longest_affix.R 100.00%
mean_na.R 100.00%
mutate_ntile.R 99.37%
mutate_other.R 100.00%
ngrep.R 100.00%
notchin.R 100.00%
notin.R 100.00%
number2word.R 100.00%
pin.R 100.00%
prohibit_unequal_length_vectors.R 100.00%
prohibit_vector_recycling.R 100.00%
provide-dir.R 100.00%
provide-file.R 100.00%
replace_pattern_in.R 100.00%
report_error.R 100.00%
samp.R 100.00%
select_grep.R 100.00%
select_which.R 100.00%
selector.R 100.00%
set_cols_first.R 100.00%
set_seed.R 100.00%
swap.R 100.00%
unique-keys.R 100.00%
utils-anyNA.R 68.75%
weight2rows.R 100.00%
weighted_ntile.R 100.00%
weighted_quantile.R 100.00%
Folder Totals (53 files) 99.60%
Project Totals (53 files) 99.60%
Loading