From fd125c476033e327434732f970547bf75699e718 Mon Sep 17 00:00:00 2001 From: hoxo_m Date: Sun, 30 Jul 2017 03:56:56 +0200 Subject: [PATCH] Refine R code a little (#263) * Replace tail(-1) with [-1] * Don't need to import utils anymore --- R/DESCRIPTION | 3 +-- R/R/prophet.R | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/R/DESCRIPTION b/R/DESCRIPTION index f74852d..126e186 100644 --- a/R/DESCRIPTION +++ b/R/DESCRIPTION @@ -22,8 +22,7 @@ Imports: rstan (>= 2.14.0), scales, stats, - tidyr (>= 0.6.1), - utils + tidyr (>= 0.6.1) Suggests: knitr, testthat, diff --git a/R/R/prophet.R b/R/R/prophet.R index 4a80efd..5864087 100644 --- a/R/R/prophet.R +++ b/R/R/prophet.R @@ -333,8 +333,7 @@ set_changepoints <- function(m) { # Place potential changepoints evenly through the first 80 pcnt of # the history. 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] } else { m$changepoints <- c()