Consider the following example:
Vars <- c("car","bike","lorry") Dat <- c(10,20,22) for (i in 1:length(Vars)){ assign(Vars[i],Dat[i]) }
Here I would like to generate three variables in the workspace, named according to the entries in Vars , and the values โโin Dat . I'm currently using a loop, but I'm trying to remove a loop with apply, what would be the best way to do this?
KatyB source share