I am wondering how assignment works in the R language.
Consider the following R shell session:
> x <- c(5, 6, 7) > x[1] <- 10 > x [1] 10 6
As per @Owen's answer to this question, x[1] <- 10 is really doing two things. It is calling the [<- function, and it is assigning the result of that call to x.
x[1] <- 10
[<-
So what you want to achieve your c(4, 5, 6)[1] <- 10 result is:
c(4, 5, 6)[1] <- 10
> `[<-`(c(4, 5, 6),1, 10) [1] 10 5 6