Skip to content

Commit

Permalink
Merge branch 'master' into fix_abe_mcmc
Browse files Browse the repository at this point in the history
  • Loading branch information
mplatzer authored Mar 13, 2017
2 parents 9bd5fe6 + 2e82c02 commit e4b2aaf
Show file tree
Hide file tree
Showing 48 changed files with 30 additions and 69 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Suggests:
rmarkdown,
lintr (>= 1.0.0)
Roxygen: list(wrap = FALSE)
RoxygenNote: 5.0.1
RoxygenNote: 6.0.1
LazyData: true
VignetteBuilder: knitr
14 changes: 9 additions & 5 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ plotTimingPatterns <- function(elog, n = 40, T.cal = NULL, T.tot = NULL,
#' \item{\code{x}}{Number of recurring events in calibration period.}
#' \item{\code{t.x}}{Time between first and last event in calibration period.}
#' \item{\code{litt}}{Sum of logarithmic intertransaction timings during calibration period.}
#' \item{\code{sales}}{Sum of sales in calibration period. Only if \code{elog$sales} is provided.}
#' \item{\code{sales}}{Sum of sales in calibration period, incl. initial transaction. Only if \code{elog$sales} is provided.}
#' \item{\code{sales.x}}{Sum of sales in calibration period, excl. initial transaction. Only if \code{elog$sales} is provided.}
#' \item{\code{first}}{Date of first transaction in calibration period.}
#' \item{\code{T.cal}}{Time between first event and end of calibration period.}
#' \item{\code{T.star}}{Length of holdout period. Only if \code{T.cal} is provided.}
Expand All @@ -274,7 +275,7 @@ plotTimingPatterns <- function(elog, n = 40, T.cal = NULL, T.tot = NULL,
#' cbs <- elog2cbs(groceryElog, T.cal = "2006-12-31", T.tot = "2007-12-30")
#' head(cbs)
elog2cbs <- function(elog, units = "week", T.cal = NULL, T.tot = NULL) {
cust <- first <- itt <- T.star <- x.star <- sales <- sales.star <- NULL # suppress checkUsage warnings
cust <- first <- itt <- T.star <- x.star <- sales <- sales.star <- sales.x <- NULL # suppress checkUsage warnings
stopifnot(inherits(elog, "data.frame"))
if (!all(c("cust", "date") %in% names(elog))) stop("`elog` must have fields `cust` and `date`")
if (!any(c("Date", "POSIXt") %in% class(elog$date))) stop("`date` field must be of class `Date` or `POSIXt`")
Expand Down Expand Up @@ -311,7 +312,8 @@ elog2cbs <- function(elog, units = "week", T.cal = NULL, T.tot = NULL) {
list(x = .N - 1,
t.x = max(t),
litt = sum(log(itt[itt > 0])),
sales = sum(sales)),
sales = sum(sales),
sales.x = sum(sales[t > 0])),
by = "cust,first"]
cbs[, `:=`(T.cal, as.numeric(difftime(T.cal, first, units = units)))]
setkey(cbs, cust)
Expand All @@ -322,14 +324,16 @@ elog2cbs <- function(elog, units = "week", T.cal = NULL, T.tot = NULL) {
cbs <- merge(cbs, val, all.x = TRUE, by = "cust")
cbs[is.na(x.star), `:=`(x.star, 0)]
cbs[is.na(sales.star), `:=`(sales.star, 0)]
setcolorder(cbs, c("cust", "x", "t.x", "litt", "sales", "first", "T.cal", "T.star", "x.star", "sales.star"))
setcolorder(cbs, c("cust", "x", "t.x", "litt", "sales", "sales.x", "first", "T.cal",
"T.star", "x.star", "sales.star"))
} else {
setcolorder(cbs, c("cust", "x", "t.x", "litt", "sales", "first", "T.cal"))
setcolorder(cbs, c("cust", "x", "t.x", "litt", "sales", "sales.x", "first", "T.cal"))
}
# return same object type as was passed
if (!has.sales) {
elog_dt[, `:=`(sales, NULL)]
cbs[, `:=`(sales, NULL)]
cbs[, `:=`(sales.x, NULL)]
if (has.holdout) cbs[, `:=`(sales.star, NULL)]
}
if (!is.dt) {
Expand Down
1 change: 0 additions & 1 deletion man/abe.GenerateData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/abe.mcmc.DrawParameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/dc.PlotFreqVsConditionalExpectedFrequency.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/dc.PlotRecVsConditionalExpectedFrequency.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/dc.PlotTracking.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/dc.check.model.params.safe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/elog2cbs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/elog2cum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/estimateRegularity.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/groceryElog.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.ConditionalExpectedTransactions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.EstimateParameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.Expectation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.ExpectedCumulativeTransactions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.GenerateData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.PAlive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.PlotFreqVsConditionalExpectedFrequency.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.PlotFrequencyInCalibration.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.PlotRecVsConditionalExpectedFrequency.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.PlotTrackingCum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.PlotTrackingInc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions man/mbgcnbd.cbs.LL.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions man/mbgcnbd.pmf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.DrawFutureTransactions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.Expectation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.ExpectedCumulativeTransactions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.PActive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.PAlive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.PlotFrequencyInCalibration.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.PlotTrackingCum.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.PlotTrackingInc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.plotPActiveDiagnostic.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.pmf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/mcmc.setBurnin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/nbd.ConditionalExpectedTransactions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/nbd.EstimateParameters.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/nbd.GenerateData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/nbd.LL.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/nbd.cbs.LL.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/pggg.GenerateData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

1 comment on commit e4b2aaf

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/testthat/test-bg-cnbd-k.R:31:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.ConditionalExpectedTransactions(params[-1], 32, 1, 16, 32),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:36:1: style: lines should not be more than 80 characters.

​               bgcnbd.PlotFrequencyInCalibration(params, cbs, 7), tolerance = 0.01)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:37:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.PlotFreqVsConditionalExpectedFrequency(params[-1], T.star = 39, cbs, cbs$x.star, 7),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:38:1: style: lines should not be more than 80 characters.

​               bgcnbd.PlotFreqVsConditionalExpectedFrequency(params, T.star = 39, cbs, cbs$x.star, 7), tolerance = 0.01)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:39:1: style: lines should not be more than 80 characters.

# Note: BTYD::bgnbd.PlotRecVsConditionalExpectedFrequency can't handle missing bins, so we can't compare
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:40:1: style: lines should not be more than 80 characters.

​  expect_silent(bgcnbd.PlotRecVsConditionalExpectedFrequency(params, cbs, T.star = 39, cbs$x.star))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:42:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.PlotTrackingInc(params[-1], cbs$T.cal, max(cbs$T.cal) + 32, inc_tracking),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:43:1: style: lines should not be more than 80 characters.

​               bgcnbd.PlotTrackingInc(params, cbs$T.cal, max(cbs$T.cal) + 32, inc_tracking),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:45:1: style: lines should not be more than 80 characters.

​  expect_silent(bgcnbd.PlotTrackingInc(params, cbs$T.cal, max(cbs$T.cal) + 32, inc_tracking,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:47:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.ExpectedCumulativeTransactions(params[-1], 11, 39, 12),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:51:1: style: lines should not be more than 80 characters.

​  expect_equal(BTYD::bgnbd.PlotTrackingCum(params[-1], cbs$T.cal, 32 + 32, cu_tracking),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:69:1: style: lines should not be more than 80 characters.

est_fixed_k <- bgcnbd.EstimateParameters(cbs[, c("x", "t.x", "T.cal", "litt")], k = params[1])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:76:1: style: lines should not be more than 80 characters.

cbs$x.est32 <- bgcnbd.ConditionalExpectedTransactions(params, 32, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-bg-cnbd-k.R:77:1: style: lines should not be more than 80 characters.

cbs$x.est64 <- bgcnbd.ConditionalExpectedTransactions(params, 64, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:5:1: style: lines should not be more than 80 characters.

elog <- data.frame(cust = c(1, 1, 1, 1, 1, 2, 3), date = Sys.Date() + c(0, 14, 14, 28, 35, 7, 24))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:6:1: style: lines should not be more than 80 characters.

elog_time <- data.frame(cust = c(1, 1, 1, 1, 1, 2, 3), date = Sys.time() + c(0, 14, 14, 28, 35, 7, 24))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:7:14: style: Words within variable and function names should be separated by '_' rather than '.'.

elog_dt <- as.data.table(elog)
             ^~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:19:1: style: lines should not be more than 80 characters.

​  expect_equal(elog2cbs(elog_time, units = "secs", T.cal = as.character(min(elog_time$date) + 21))[, 1:4],
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:20:1: style: lines should not be more than 80 characters.

​               elog2cbs(elog, units = "days", T.cal = as.character(Sys.Date() + 21))[, 1:4])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:28:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "sales", "sales.x", "first", "T.cal"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:30:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "sales", "sales.x", "first", "T.cal", "T.star", "x.star", "sales.star"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:32:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "first", "T.cal", "T.star", "x.star"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:34:1: style: lines should not be more than 80 characters.

​               c("cust", "x", "t.x", "litt", "first", "T.cal", "T.star", "x.star"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:37:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog$cust), nrow(elog2cbs(elog)))
               ^~~~~~~

tests/testthat/test-elog2cbs.R:38:1: style: lines should not be more than 80 characters.

​  expect_equal(uniqueN(elog[elog$date <= T.cal, "cust"]), nrow(elog2cbs(elog, T.cal = T.cal)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:38:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog[elog$date <= T.cal, "cust"]), nrow(elog2cbs(elog, T.cal = T.cal)))
               ^~~~~~~

tests/testthat/test-elog2cbs.R:42:1: style: lines should not be more than 80 characters.

​  expect_equal(uniqueN(elog_dt[, .(cust, date)]), sum(cbs$x) + sum(cbs$x.star) + nrow(cbs))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:42:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog_dt[, .(cust, date)]), sum(cbs$x) + sum(cbs$x.star) + nrow(cbs))
               ^~~~~~~

tests/testthat/test-elog2cbs.R:47:1: style: lines should not be more than 80 characters.

​  expect_equal(uniqueN(elog_dt[elog_dt$first <= T.cal & date <= T.tot, .(cust, date)]),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:47:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(elog_dt[elog_dt$first <= T.cal & date <= T.tot, .(cust, date)]),
               ^~~~~~~

tests/testthat/test-elog2cbs.R:52:1: style: lines should not be more than 80 characters.

​  expect_equal(elog_s[first <= T.cal & date <= T.cal, sum(sales)], sum(cbs$sales))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:53:1: style: lines should not be more than 80 characters.

​  expect_equal(elog_s[first < date & first <= T.cal & date <= T.cal, sum(sales)], sum(cbs$sales.x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:54:1: style: lines should not be more than 80 characters.

​  expect_equal(elog_s[first <= T.cal & date <= T.tot, sum(sales)], sum(cbs$sales) + sum(cbs$sales.star))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:57:1: style: lines should not be more than 80 characters.

cbs <- elog2cbs(elog_s, T.cal = as.character(T.cal), T.tot = as.character(T.tot))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:65:1: style: lines should not be more than 80 characters.

​  expect_equal(elog2cbs(elog, units = "hours")$t.x / (7 * 24), elog2cbs(elog)$t.x)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:66:1: style: lines should not be more than 80 characters.

elog_time <- data.frame(cust = c(1, 1, 1, 1, 1, 2, 3), date = Sys.time() + c(0, 14, 14, 28, 35, 7, 24))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-elog2cbs.R:67:1: style: lines should not be more than 80 characters.

​  expect_equal(elog2cbs(elog, units = "days")[, c(1:4, 6)], elog2cbs(elog_time, units = "secs")[, c(1:4, 6)])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:8:1: style: lines should not be more than 80 characters.

​  expect_silent(BTYDplus:::dc.check.model.params.safe(printnames, params, "foo"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:12:1: style: lines should not be more than 80 characters.

​  expect_silent(BTYDplus:::dc.check.model.params.safe(printnames, params, "foo"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:25:1: style: lines should not be more than 80 characters.

col.names = c("cust", "sampleid", "date", "cds", "sales"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:28:15: style: Variable and function names should be all lowercase.

utils::data(cdnowSummary, package = "BTYD", envir = environment())
              ^~~~~~~~~~~~

tests/testthat/test-helpers.R:29:21: style: Variable and function names should be all lowercase.

​  expect_equal(cum, cdnowSummary$cu.tracking)
                    ^~~~~~~~~~~~

tests/testthat/test-helpers.R:37:1: style: lines should not be more than 80 characters.

​  expect_equal(diff(elog2cum(elog, by = 7, first = TRUE)), elog2inc(elog, by = 7, first = TRUE))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:39:1: style: lines should not be more than 80 characters.

​  expect_equal(tail(elog2cum(elog, by = 1, first = FALSE), 1), nrow(elog) - uniqueN(elog$cust))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:39:77: style: Variable and function names should be all lowercase.

​  expect_equal(tail(elog2cum(elog, by = 1, first = FALSE), 1), nrow(elog) - uniqueN(elog$cust))
                                                                            ^~~~~~~

tests/testthat/test-helpers.R:41:1: style: lines should not be more than 80 characters.

elog <- data.table(cust = c(1, 1, 1, 1, 1, 3, 3), t = c(0, 9, 9, 20, 22, 4, 6))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:51:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(groceryElog, headers = c("X", "Y"), title = ""))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:52:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(groceryElog, T.cal = "2006-12-31", title = NULL))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:53:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(groceryElog, T.cal = "2006-12-31", T.tot = "2007-06-30",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-helpers.R:57:1: style: lines should not be more than 80 characters.

​  expect_silent(plotTimingPatterns(head(groceryElog, 10), T.cal = "2006-12-31", T.tot = "2007-12-30"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:20:1: style: lines should not be more than 80 characters.

est2 <- mbgcnbd.EstimateParameters(cbs[, c("x", "t.x", "T.cal", "litt")], k = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:28:1: style: lines should not be more than 80 characters.

cbs$x.est <- mbgcnbd.ConditionalExpectedTransactions(params, cbs$T.star, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:47:1: style: lines should not be more than 80 characters.

​  expect_silent(mbgcnbd.PlotTrackingInc(params, cbs$T.cal, max(cbs$T.cal + cbs$T.star), elog2inc(elog, by = 14)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:48:1: style: lines should not be more than 80 characters.

​  expect_silent(mbgcnbd.PlotTrackingCum(params, cbs$T.cal, max(cbs$T.cal + cbs$T.star), elog2cum(elog, by = 14)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:51:1: style: lines should not be more than 80 characters.

mat <- mbgcnbd.PlotFreqVsConditionalExpectedFrequency(params, cbs$T.star, cbs, cbs$x.star, 7)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:55:1: style: lines should not be more than 80 characters.

​  expect_lt(mbgcnbd.ConditionalExpectedTransactions(params, T.star = 32, x = c(0, 1), t.x = c(0, 12), T.cal = 32)[2], 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:56:1: style: lines should not be more than 80 characters.

​  expect_true(mbgcnbd.ConditionalExpectedTransactions(params, T.star = 32, x = 3, t.x = 12, T.cal = 32) !=
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:57:1: style: lines should not be more than 80 characters.

​                mbgcnbd.ConditionalExpectedTransactions(params, T.star = 32, x = 2, t.x = 12, T.cal = 32))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mbg-cnbd-k.R:67:1: style: lines should not be more than 80 characters.

cbs$x.est <- mbgcnbd.ConditionalExpectedTransactions(params, cbs$T.star, cbs$x, cbs$t.x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:17:1: style: lines should not be more than 80 characters.

abe_params$beta <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:20:1: style: lines should not be more than 80 characters.

abe_draws <- abe.mcmc.DrawParameters(abe_cbs, c("covariate_1", "covariate_2"), mcmc, burnin, thin, chains)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:25:1: style: lines should not be more than 80 characters.

pggg_draws <- pggg.mcmc.DrawParameters(pggg_cbs, mcmc / 10, burnin / 10, thin / 10, chains)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:32:1: style: lines should not be more than 80 characters.

pnbd_xstar_draws1 <- mcmc.DrawFutureTransactions(pnbd_cbs, pnbd_draws, sample_size = size)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:35:1: style: lines should not be more than 80 characters.

pnbd_xstar_draws2 <- mcmc.DrawFutureTransactions(pnbd_cbs, pnbd_draws, sample_size = size)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:37:1: style: lines should not be more than 80 characters.

​  expect_gt(cor(apply(pnbd_xstar_draws2, 2, mean), apply(pnbd_xstar_draws, 2, mean)), 0.95)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:38:1: style: lines should not be more than 80 characters.

​  expect_silent(pnbd_xstar_draws <- mcmc.DrawFutureTransactions(pnbd_cbs, pnbd_draws, T.star = 10))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:46:1: style: lines should not be more than 80 characters.

​  expect_equal(dim(pnbd_xstar_draws3), c((mcmc + burnin - burnin2) * chains / thin, nrow(pnbd_cbs)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:46:42: style: Place a space before left parenthesis, except in a function call.

​  expect_equal(dim(pnbd_xstar_draws3), c((mcmc + burnin - burnin2) * chains / thin, nrow(pnbd_cbs)))
                                         ^

tests/testthat/test-mcmc.R:85:1: style: lines should not be more than 80 characters.

​  expect_equal(mcmc.Expectation(pnbd_draws, 28), mean(pnbd_cbs$x), tolerance = 0.1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:86:1: style: lines should not be more than 80 characters.

x <- mcmc.ExpectedCumulativeTransactions(pnbd_draws, T.cal = pnbd_cbs$T.cal, T.tot = 56, n.periods.final = 56)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-mcmc.R:99:1: style: lines should not be more than 80 characters.

BTYD::pnbd.PlotFrequencyInCalibration(unlist(pnbd_params), pnbd_cbs, censor = 7),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-nbd.R:18:1: style: lines should not be more than 80 characters.

cbs$x.est <- nbd.ConditionalExpectedTransactions(params, cbs$T.star, cbs$x, cbs$T.cal)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:12:37: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- pggg.mcmc.DrawParameters(as.data.table(cbs),
                                    ^~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:13:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:14:1: style: lines should not be more than 80 characters.

param_init = list(r = 1, alpha = 1, s = 1, beta = 1, t = 1, gamma = 1))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-ggg-mcmc.R:16:1: style: lines should not be more than 80 characters.

mcmc = 100, burnin = 20, thin = 10, chains = 2, mc.cores = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:9:1: style: lines should not be more than 80 characters.

params$beta <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:12:1: style: lines should not be more than 80 characters.

covariates = matrix(c(rnorm(n), runif(n)), ncol = 2)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:14:1: style: lines should not be more than 80 characters.

covariates = matrix(c(rnorm(n), runif(n)), ncol = 2,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:15:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, c("x1", "x2")))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:18:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, c("x1")))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:21:1: style: lines should not be more than 80 characters.

covariates = matrix(c(rnorm(n), runif(n), runif(n)), ncol = 3,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:22:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, c("x1", "x2", "x3")))),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:26:1: style: lines should not be more than 80 characters.

​  expect_silent(abe.GenerateData(n, 36, 36, params, covariates = matrix(rnorm(n), ncol = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:27:1: style: lines should not be more than 80 characters.

dimnames = list(NULL, "x1"))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:32:1: style: lines should not be more than 80 characters.

params$beta <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:40:1: style: lines should not be more than 80 characters.

# TODO: test param recoverability with covars being provided to abe.GenerateData
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:48:36: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- abe.mcmc.DrawParameters(as.data.table(cbs),
                                   ^~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:49:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:50:1: style: lines should not be more than 80 characters.

draws <- abe.mcmc.DrawParameters(as.data.table(cbs), covariates = c("covariate_1"),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:50:36: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- abe.mcmc.DrawParameters(as.data.table(cbs), covariates = c("covariate_1"),
                                   ^~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:51:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:54:1: style: lines should not be more than 80 characters.

draws <- abe.mcmc.DrawParameters(cbs, covariates = c("covariate_1", "covariate_2"), mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:57:1: style: lines should not be more than 80 characters.

​  expect_true(all(c("lambda", "mu", "z", "tau") %in% colnames(as.matrix(draws$level_1[[1]]))))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:58:1: style: lines should not be more than 80 characters.

​  expect_true(all(c("log_lambda_intercept", "log_mu_intercept", "log_lambda_covariate_1", "log_mu_covariate_1",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:59:1: style: lines should not be more than 80 characters.

"log_lambda_covariate_2", "log_mu_covariate_2", "var_log_lambda", "cov_log_lambda_log_mu", "var_log_mu") %in%
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:67:1: style: lines should not be more than 80 characters.

​  expect_equal(matrix(est[1:6], ncol = 2, byrow = T), params$beta, tolerance = 0.05)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:70:1: style: lines should not be more than 80 characters.

​  expect_equal(unname(est["var_log_lambda"]), params$gamma[1, 1], tolerance = 0.1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:71:1: style: lines should not be more than 80 characters.

​  expect_equal(unname(est["cov_log_lambda_log_mu"]), params$gamma[1, 2], tolerance = 0.1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:95:1: style: lines should not be more than 80 characters.

covariates = cbs[, c("covariate_1", "covariate_2")])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-abe.R:103:1: style: lines should not be more than 80 characters.

covariates = cbs[, c("covariate_1", "covariate_2")])
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:17:16: style: Variable and function names should be all lowercase.

​  expect_equal(uniqueN(sim$elog$cust), n)
               ^~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:30:1: style: lines should not be more than 80 characters.

sim <- pggg.GenerateData(100, 52, c(26, 104), params, date.zero = as.Date("2010-01-01"))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:61:37: style: Words within variable and function names should be separated by '_' rather than '.'.

draws <- pnbd.mcmc.DrawParameters(as.data.table(cbs),
                                    ^~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:62:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 1, mc.cores = 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:63:1: style: lines should not be more than 80 characters.

param_init = list(r = 1, alpha = 1, s = 1, beta = 1))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:95:1: style: lines should not be more than 80 characters.

mcmc = 10, burnin = 0, thin = 2, chains = 2,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-pareto-nbd-mcmc.R:96:1: style: lines should not be more than 80 characters.

use_data_augmentation = FALSE, mc.cores = 1)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-timing.R:17:1: style: lines should not be more than 80 characters.

​  expect_error(k_est_1 <- estimateRegularity(elog, plot = TRUE, min = 60), "sufficient")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-timing.R:21:1: style: lines should not be more than 80 characters.

k_est_3 <- estimateRegularity(elog, method = "mle-minka", plot = TRUE, title = "Plot Title")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

tests/testthat/test-timing.R:22:1: style: lines should not be more than 80 characters.

k_est_4 <- estimateRegularity(elog, method = "mle-thom", plot = TRUE, title = "")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please sign in to comment.