I am using sequence function in R. While it gives correct output for positive numbers when used input is given using ‘:’, I am not sure why does the following 2 ways produce different outputs (when input starts with negative integer in ‘:’ format):
seq(-1,1)
[1] -1 0 1
seq(-1:1)
[1] 1 2 3
I was expecting the same output.
New contributor
Gaurav Shukla is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.