I try to concatenate a variable name by a string and a variable value to call an existing variable which I can use in further procedures, f.e.
var_pre23 <- "it works" # existing variable
var_pre <- "var_pre"
var_add <- 23
var_comb <- paste0 (var_pre, var_add) # results in "var_pre23"
print (var_comb) # this should lead to printing "it works"
I want to concatenate "var_add" and "var_pre" to a variable "var_pre23". The real variable "var_pre23" already exists and has the value "it works". So in the end I want to use
print(var_comb)
and receive the value "it works".
I know that from other script languages - as far as I remember in PHP it works like
echo ${"var_pre23"} or ${$var_pre.$var_add}
I think I only need a specific command for that.
Thank you!!