0

I would like to read a data frame from a string. It is a bit difficult to explain, and, so far I couldn't find the answer anywhere.

Let's imagine I have several data frames: "Param1", "Param2", ... "Param100". I would like to be able to access them from a for loop:

for (i in c(1:100)){
  a <- paste0("Param",i)
  b <- ??? (a)
}

Where b would become "Param1", ... "Param100" when i varies from 1 to 100.

Jaap
  • 81,064
  • 34
  • 182
  • 193
T.Des
  • 80
  • 8

1 Answers1

2

Use get.

for (i in 1:100) {
  b <- get(paste0("Param", i))
}
Josh
  • 1,248
  • 12
  • 25