rkillick / changepoint

A place for the development version of the changepoint package on CRAN.
127 stars 33 forks source link

error on design(...,p<1) #43

Closed mpadge closed 3 years ago

mpadge commented 4 years ago

This came up as part of going through package for the rOpenSci Statistical Software Review project, in particular through applying the autotest package, which throws all sorts of unexpected input at packages. I'm opening PRs/issues for any code that behaves dangerously (generally meaning it kills my R session).

In this case, without this line, any negative values for p are passed through to https://github.com/rkillick/changepoint/blob/34856c63778dbbdee84289310a8154208acf49ed/R/design.R#L7 and the rep(1,n-p) line will still generate results. Submitting p = -.Machine$integer.max generates very nasty results.

codecov[bot] commented 4 years ago

Codecov Report

Merging #43 into master will decrease coverage by 0.89%. The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #43      +/-   ##
==========================================
- Coverage   56.15%   55.25%   -0.90%     
==========================================
  Files          23       23              
  Lines        2292     2141     -151     
==========================================
- Hits         1287     1183     -104     
+ Misses       1005      958      -47     
Impacted Files Coverage Δ
R/design.R 92.85% <50.00%> (-7.15%) :arrow_down:
R/decision.R 50.00% <0.00%> (-10.00%) :arrow_down:
R/gamma.R 41.37% <0.00%> (-5.63%) :arrow_down:
R/exp.R 50.54% <0.00%> (-2.09%) :arrow_down:
R/single.norm.R 56.34% <0.00%> (-2.03%) :arrow_down:
R/cpt.class.R 35.06% <0.00%> (-1.68%) :arrow_down:
src/BinSeg_one_func_minseglen.c 91.04% <0.00%> (-0.14%) :arrow_down:
src/PELT_one_func_minseglen.c 85.71% <0.00%> (-0.13%) :arrow_down:
src/cptreg_AMOC.c 0.00% <0.00%> (ø)
R/range_of_penalties.R 100.00% <0.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 34856c6...252de68. Read the comment docs.

rkillick commented 3 years ago

Thanks for highlighting this.