In R language, for loop or array truncation, the following error occurs only 0’s may be mixed with negative subscripts

Only 0’s May be mixed with negative subscripts when writing loop statements in R language or truncating arrays

This error is usually caused by writing arrays like x[i-10: I + J-10], and is corrected by enclosing i-10 and I + J-10 in parentheses, such as x[(i-10): I + J-10)].

This will solve the problem, the R beginners must pay attention to these details, otherwise they will be tormented by this small problem


Read More: