You can use a for
loop with the seq()
function to loop from 10 to 5 in R. Here's an example code that illustrates this:
main.r41 chars4 lines
In the code above, seq(10, 5, -1)
generates a sequence of numbers from 10 to 5 with a decrement of 1. The for
loop iterates over this sequence, assigning each number to the i
variable, and then printing it using the print()
function. You can replace the print()
function with any code that you want to execute inside the loop.
gistlibby LogSnag