I am trying to take the number 1663126215 and I want to subtract "8400" from this number 1000 times and keep all the results. I thought that maybe I can write a loop for this:
the_list = list()
for (i in 1:1000)
{
new_i = 1663126215 - 8400*i
the_list[[i]] <- new_i
}
I am not sure I have this done correctly - can someone please confirm? Are there other ways I could have done this?
Thank you!
CodePudding user response:
We can try using a sequence here:
output <- 1663126215 - 8400*seq(1:1000)
output
[1] 1663117815 1663109415 1663101015 1663092615 1663084215 1663075815
[7] 1663067415 1663059015 1663050615 1663042215 ...