I also have two vectors under the "Values" section in my Rstudio named “object1” and “object2”, each containing 10 different numeric values. Let say, “object1” contains values from 91 to 100, and "“object2” has values from 101 to 110 (in reality those values are different, but it is only an example). I want to create a new column in “df”, in which values from “object1” will correspond to the first 10 rows of "West", and then get applied again to the next 10 rows of "West". Values from “object2” have to correspond to “Atlantic constrained” in “inst”. So the final output has to look like this:
If there is some principled 'reason' behind combining your objects, I would lean into that, and write a program that combines things based on those reasons, the way you have presented what you want to do seems rather arbitrary, so the code that will get written to implement it will by necessity be quite arbitrary.
That said, if you wish to hack on in this vain... you can at least reduce it to manually writing out a pattern of numbers.
library(tidyverse)
object1 <- 1:10
object2 <- 101:110
df <- data.frame(New_column = c(rep("West", 20), rep("Atlantic constrained", 10)))
df2 <- bind_rows(df,df) #extending the example to be more interesting in how we cover it with repetitions
# construct a pattern programmatically
(onums <- rep(c(1,1:2),2)) #use rep() for easy repetition of fixed patterns
(onames <- paste0("object",onums))
(ovals <- mget(onames))
df2 <- df2 |>
add_column(inst3 = unlist(ovals))
There's a function for that: rep(object1, times = 20)
Then, as nirgrahamuk says, if you can lean on the reason for that pattern it's much better (I'm particularly worried about assuming the order of the df matches the order within the objects, one of these days one vector could be sorted differently, and you wouldn't even notice that all your results are wrong).