Skip to content

Commit 0f06a88

Browse files
committed
forget to remove wrapping into list, amend error for different types
1 parent 7e2e760 commit 0f06a88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/froll.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ partial2adaptive = function(x, n, align, adaptive) {
5050
} else {
5151
if (!(is.numeric(n) || (is.list(n) && all(vapply_1b(n, is.numeric)))))
5252
stopf("n must be an integer vector or a list of integer vectors")
53-
if (!is.list(n))
54-
n = list(n)
5553
if (length(unique(lengths(n))) != 1L)
5654
stopf("adaptive window provided in 'n' must not to have different lengths")
57-
if (length(n[[1L]]) != len)
55+
if (is.numeric(n) && length(n) != len)
56+
stopf("length of integer vector(s) provided as list to 'n' argument must be equal to number of observations provided in 'x'")
57+
if (is.list(n) && length(n[[1L]]) != len)
5858
stopf("length of vectors in 'x' must match to length of adaptive window in 'n'")
5959
if (verbose)
6060
catf("partial2adaptive: froll adaptive=TRUE and partial=TRUE trimming 'n'\n")

0 commit comments

Comments
 (0)