Skip to content
Prev 361153 / 398506 Next

Sprintf to call data frame from environment

You are treating this as if R were a macro processor, which it's not. The only function that lets you pull in a data-object from the store of named objects using a character vector is `get`, so perhaps:

get( sprintf("Samples_%s.txt", 1) )$V1

And if you were considering the next step of hoping to pass a computed item to `$`, then forget that as well, and learn to use `[`.