I want to make a list of consecutive numbers like this:
list(1,2,3,4)
Gives list of four.
Now I don't want to write all numbers, so try:
list(1:4)
Gives List of length four.
If I want to make a list of four without writing all the numbers what could be the syntax?
Please help, thanks
You can use
as.list(1:4)
EDIT
or
as.list(seq(4))
EDIT #2
Here's a speed comparison using
microbenchmark
: