Re: [R] Sprintf to call data frame from environment

2016-05-24 Thread Jim Lemon
Hi Beatriz, I'll guess that you have a number of files with names like this: Samples_1.txt Samples_2.txt ... Each one can be read with a function like read.table and will return a data frame with default names (V1, V2, ...). You then want to extract the first element (column) of the data frame. I

Re: [R] Sprintf to call data frame from environment

2016-05-24 Thread David Winsemius
> On May 24, 2016, at 2:01 PM, Beatriz wrote: > > > In my environment I have a data frame called Samples_1.txt. > From this data frame I need to get variable V1. My code doesn't work. Thanks! > > $V1 > > Note: I need to do it in this way because I have the code into a for loop. You ar

Re: [R] Sprintf to call data frame from environment

2016-05-24 Thread Nordlund, Dan (DSHS/RDA)
It is not clear (at least to me) what your actual task is. But, if Samples_1.txt is the actual name of a data frame that exists in memory (and not a filename), then you need to wrap the sprintf() in a get() function. get(sprintf("Samples_%s.txt", 1))$V1 I am no expert on "computing on the lan