瀏覽代碼

Refine R code a little (#263)

* Replace tail(-1) with [-1]

* Don't need to import utils anymore
hoxo_m 8 年之前
父節點
當前提交
fd125c4760
共有 2 個文件被更改,包括 2 次插入4 次删除
  1. 1 2
      R/DESCRIPTION
  2. 1 2
      R/R/prophet.R

+ 1 - 2
R/DESCRIPTION

@@ -22,8 +22,7 @@ Imports:
     rstan (>= 2.14.0),
     rstan (>= 2.14.0),
     scales,
     scales,
     stats,
     stats,
-    tidyr (>= 0.6.1),
-    utils
+    tidyr (>= 0.6.1)
 Suggests:
 Suggests:
     knitr,
     knitr,
     testthat,
     testthat,

+ 1 - 2
R/R/prophet.R

@@ -333,8 +333,7 @@ set_changepoints <- function(m) {
       # Place potential changepoints evenly through the first 80 pcnt of
       # Place potential changepoints evenly through the first 80 pcnt of
       # the history.
       # the history.
       cp.indexes <- round(seq.int(1, floor(nrow(m$history) * .8),
       cp.indexes <- round(seq.int(1, floor(nrow(m$history) * .8),
-                          length.out = (m$n.changepoints + 1))) %>%
-                    utils::tail(-1)
+                          length.out = (m$n.changepoints + 1))[-1])
       m$changepoints <- m$history$ds[cp.indexes]
       m$changepoints <- m$history$ds[cp.indexes]
     } else {
     } else {
       m$changepoints <- c()
       m$changepoints <- c()