From a37375c11f181ff5901e00a3c1d1ce90b3a2ade3 Mon Sep 17 00:00:00 2001 From: Siddd-hrr Date: Sat, 2 Aug 2025 09:35:29 +0530 Subject: [PATCH 1/2] Update seq.c --- src/main/seq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/seq.c b/src/main/seq.c index 1ddd3c6cc7a..61abc30fcf5 100644 --- a/src/main/seq.c +++ b/src/main/seq.c @@ -745,7 +745,9 @@ attribute_hidden SEXP do_rep(SEXP call, SEXP op, SEXP args, SEXP rho) len = lx * it * each; } else { // nt != 1 if(nt != (double) lx * each) - errorcall(call, _("invalid '%s' argument"), "times"); + 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 ); + + if (TYPEOF(times) == REALSXP) for(i = 0; i < nt; i++) { double rt = REAL(times)[i]; From 543dd26c9c03315779e31ae38bd83a6197ab38c7 Mon Sep 17 00:00:00 2001 From: Siddd-hrr Date: Fri, 15 Aug 2025 12:11:47 +0530 Subject: [PATCH 2/2] Update seq.c --- src/main/seq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/seq.c b/src/main/seq.c index 61abc30fcf5..e4dee1837d7 100644 --- a/src/main/seq.c +++ b/src/main/seq.c @@ -744,10 +744,11 @@ attribute_hidden SEXP do_rep(SEXP call, SEXP op, SEXP args, SEXP rho) errorcall(call, _("invalid '%s' argument"), "times"); len = lx * it * each; } else { // nt != 1 - if(nt != (double) lx * each) - 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 ); - - + if(nt != (double) lx * each){ + if(each == 0) errorcall(call, _("invalid '%s' argument, given the value of '%s' "), "each","times"); + if(each == 1) errorcall(call,_("invalid '%s' argument"),"times"); + errorcall(call, _("invalid '%s' argument, given the value of '%s'"), "times", "each"); + } if (TYPEOF(times) == REALSXP) for(i = 0; i < nt; i++) { double rt = REAL(times)[i];