Skip to content

Commit d9786a4

Browse files
authored
Merge pull request #2 from Siddd-hrr/Siddd-hrr-patch-2
Update seq.c
2 parents 8a22c96 + 543dd26 commit d9786a4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/seq.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,11 @@ attribute_hidden SEXP do_rep(SEXP call, SEXP op, SEXP args, SEXP rho)
744744
errorcall(call, _("invalid '%s' argument"), "times");
745745
len = lx * it * each;
746746
} else { // nt != 1
747-
if(nt != (double) lx * each)
748-
errorcall(call,_("invalid '%s' argument: length of time = %d, expected = %d from (length of x = %d , each = %d) "),"times",nt,(int)((double) lx * each),(int) lx , (int) each );
749-
750-
747+
if(nt != (double) lx * each){
748+
if(each == 0) errorcall(call, _("invalid '%s' argument, given the value of '%s' "), "each","times");
749+
if(each == 1) errorcall(call,_("invalid '%s' argument"),"times");
750+
errorcall(call, _("invalid '%s' argument, given the value of '%s'"), "times", "each");
751+
}
751752
if (TYPEOF(times) == REALSXP)
752753
for(i = 0; i < nt; i++) {
753754
double rt = REAL(times)[i];

0 commit comments

Comments
 (0)