Transforming cyclical values into a vector

Hello. I have the following for-loop:

for(x in seq(1,2,0.1)){
  
  k=4
  b=5
  f=k*x+b
  print(f)
}

It gives the result as following:

[1] 9
[1] 9.4
[1] 9.8
[1] 10.2
[1] 10.6
[1] 11
[1] 11.4
[1] 11.8
[1] 12.2
[1] 12.6
[1] 13

I'd like to tranform these values into a single vector: in other words, I need to get the following result of the loop procession:

[1] 9 9.4 9.8 10.2 10.6 11 11.4 11.8 12.2 12.6 13

I've already tried f<-as.vector(f) and f<-c(f), but this tranformation gives only the last value of the sequence: 13

Could you,please,help me to solve this task?
Thank you for your effort!

you don't need a loop for that

  k <- 4
  b <- 5

(f <- k*seq(1,2,0.1)+b)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

f <- vector()

for(x in seq(1,2,0.1)){
  k=4
  b=5
  f=c(f,k*x+b)
}

f

Of course, this variant exists, but I am interested in the case, where I have to transform for-loop values into a single vector. How can I implement such a transformation?