I have two vectors:
years<-c(1995:1999)
values<-c(1:5)
I want to create five objects, named "Obj1995", "Obj1996" etc., and assign them the values in values in that order, so that Obj1995==1, Obj1996==2 etc.
I tried using assign():
assign(paste0("Obj",years),values)
but that's not vectorized, so it only created one object, containing all of values:
In assign(paste0("Obj",years),values) :
only the first element is used as variable name
Is there a way of achieving my goal without a for-loop?
yr_DF = data.frame(yr = years, v = values)or similar...library("fortunes"); fortune(236)