To display a range from 1 to 10 in R, you can use the :
operator to create a sequence of numbers:
main.r5 chars2 lines
This will create a vector with all the integers from 1 to 10. To print this vector, simply enter its name at the console:
main.r26 chars3 lines
This will output the following:
main.r34 chars2 lines
You can also use the seq()
function to create a sequence of numbers:
main.r23 chars2 lines
This will create a vector with all the integers from 1 to 10. To print this vector, simply enter its name at the console:
main.r44 chars3 lines
This will output the same as the previous example:
main.r34 chars2 lines
gistlibby LogSnag