. Advertisement .
..3..
. Advertisement .
..4..
Hi everyone. I really need your help to fix my error ‘error in rep(1, n) : invalid ‘times’ argument”. The detail is below:
In this code, I repeat the number 1 four times using the rep()
function.
val <- rep(1, -4)
val
Error in rep(1, -4) : invalid 'times' argument
The cause: The mistake was made because the
times
argument was set to a negative number when it should only have a non-negative value.Solution:
By using a positive number for the
times
argument, we can fix the problem. Let’s examine the updated code: