[R] From object name strings to objects

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Tue May 19 12:54:25 CEST 2026


See ?mget

On Tue, May 19, 2026, 6:49 AM Naresh Gurbuxani <naresh_gurbuxani using hotmail.com>
wrote:

>
> 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
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list