[R] From object name strings to objects

Naresh Gurbuxani n@re@h_gurbux@n| @end|ng |rom hotm@||@com
Tue May 19 12:48:56 CEST 2026


I want to stack several dataframes using their names as strings.

df1 <- data.frame(name = "normal", x = rnorm(5))
df2 <- data.frame(name = "uniform", x = runif(5))
df3 <- data.frame(name = "binomial", x = rbinom(5, 2, 0.5))
mynames <- c("df1", "df2", "df3")

newdf <- some_function(mynames)

# Desired result
newdf <- do.call(rbind, list(df1, df2, df3))

How can this be done?

Thanks,
Naresh



More information about the R-help mailing list