Running 'testthat.R' [3s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(segclust2d)
  > 
  > test_check("segclust2d")
  -- 1. Error: Test of segmentation (@test_segclust.R#7)  ------------------------
  Evaluation error: could not find function "n".
  1: segmentation(data, Kmax = 10, lmin = 5, scale.variable = T, type = "home-range", 
         seg.var = c("x", "y")) at testthat/test_segclust.R:7
  2: segmentation.data.frame(data, Kmax = 10, lmin = 5, scale.variable = T, type = "home-range", 
         seg.var = c("x", "y"))
  3: segmentation_internal(x, seg.var = seg.var, diag.var = diag.var, order.var = order.var, 
         Kmax = Kmax, lmin = lmin, dat = dat, type = type, ...)
  4: lapply(1:Kmax, function(k) {
         out <- stat_segm(x, diag.var = diag.var, order.var = order.var, param = res.DynProg, 
             seg.type = "segmentation", nseg = k)
         names(out) <- c("segments", "states")
         return(out)
     })
  5: FUN(X[[i]], ...)
  6: stat_segm(x, diag.var = diag.var, order.var = order.var, param = res.DynProg, seg.type = "segmentation", 
         nseg = k)
  7: calc_stat_states(subdata, df.segm, diag.var, order.var)
  8: eval(parse(text = eval_str))
  9: eval(parse(text = eval_str))
  10: dplyr::group_by(data, state) %>% dplyr::summarise(prop = n()/nrow(data), mu.x = mean(x, 
         na.rm = T), mu.y = mean(y, na.rm = T), sd.x = stats::sd(x, na.rm = T), sd.y = stats::sd(y, 
         na.rm = T)) %>% as.data.frame()
  11: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  12: eval(quote(`_fseq`(`_lhs`)), env, env)
  13: eval(quote(`_fseq`(`_lhs`)), env, env)
  14: `_fseq`(`_lhs`)
  15: freduce(value, `_function_list`)
  16: function_list[[i]](value)
  17: dplyr::summarise(., prop = n()/nrow(data), mu.x = mean(x, na.rm = T), mu.y = mean(y, 
         na.rm = T), sd.x = stats::sd(x, na.rm = T), sd.y = stats::sd(y, na.rm = T))
  18: summarise.tbl_df(., prop = n()/nrow(data), mu.x = mean(x, na.rm = T), mu.y = mean(y, 
         na.rm = T), sd.x = stats::sd(x, na.rm = T), sd.y = stats::sd(y, na.rm = T))
  19: summarise_impl(.data, dots, environment(), caller_env())
  
  -- 2. Error: Test of segmentation/clustering (@test_segclust.R#19)  ------------
  Evaluation error: could not find function "n".
  1: segclust(data, Kmax = 10, lmin = 5, ncluster = 3, scale.variable = T, type = "behavior", 
         seg.var = c("x", "y"), subsample_over = 1000) at testthat/test_segclust.R:19
  2: segclust.data.frame(data, Kmax = 10, lmin = 5, ncluster = 3, scale.variable = T, 
         type = "behavior", seg.var = c("x", "y"), subsample_over = 1000)
  3: segclust_internal(x, seg.var = seg.var, diag.var = diag.var, order.var = order.var, 
         Kmax = Kmax, ncluster = ncluster, lmin = lmin, dat = dat, type = type, ...)
  4: lapply(1:Kmax, function(k) {
         out <- stat_segm(x, diag.var, order.var, param = res.DynProg, nseg = k, seg.type = "segmentation")
         names(out) <- c("segments", "states")
         return(out)
     })
  5: FUN(X[[i]], ...)
  6: stat_segm(x, diag.var, order.var, param = res.DynProg, nseg = k, seg.type = "segmentation")
  7: calc_stat_states(subdata, df.segm, diag.var, order.var)
  8: eval(parse(text = eval_str))
  9: eval(parse(text = eval_str))
  10: dplyr::group_by(data, state) %>% dplyr::summarise(prop = n()/nrow(data), mu.x = mean(x, 
         na.rm = T), mu.y = mean(y, na.rm = T), sd.x = stats::sd(x, na.rm = T), sd.y = stats::sd(y, 
         na.rm = T)) %>% as.data.frame()
  11: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  12: eval(quote(`_fseq`(`_lhs`)), env, env)
  13: eval(quote(`_fseq`(`_lhs`)), env, env)
  14: `_fseq`(`_lhs`)
  15: freduce(value, `_function_list`)
  16: function_list[[i]](value)
  17: dplyr::summarise(., prop = n()/nrow(data), mu.x = mean(x, na.rm = T), mu.y = mean(y, 
         na.rm = T), sd.x = stats::sd(x, na.rm = T), sd.y = stats::sd(y, na.rm = T))
  18: summarise.tbl_df(., prop = n()/nrow(data), mu.x = mean(x, na.rm = T), mu.y = mean(y, 
         na.rm = T), sd.x = stats::sd(x, na.rm = T), sd.y = stats::sd(y, na.rm = T))
  19: summarise_impl(.data, dots, environment(), caller_env())
  
  == testthat results  ===========================================================
  OK: 0 SKIPPED: 0 FAILED: 2
  1. Error: Test of segmentation (@test_segclust.R#7) 
  2. Error: Test of segmentation/clustering (@test_segclust.R#19) 
  
  Error: testthat unit tests failed
  Execution halted