[Rd] rep(): Expecting an argument-is-missing error, but ...

Peter Langfelder peter@|@ng|e|der @end|ng |rom gm@||@com
Thu Dec 11 09:21:01 CET 2025


I think it's a bit of a quirk of rep:

> rep("x")
> [1] "x"

Help of 'rep' does state this:

The default behaviour is as if the call was

       rep(x, times = 1, length.out = NA, each = 1)

So it seems to even be documented.

Peter


Peter

On Thu, Dec 11, 2025 at 2:40 PM Henrik Bengtsson
<henrik.bengtsson using gmail.com> wrote:
>
> What's going on here:
>
> $ R --vanilla --quiet
> > f <- function(n) rep("x", times = n)
> > f()
> [1] "x"
>
> ?
>
> > getRversion()
> [1] ‘4.5.2’
>
> /Henrik
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list