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
> 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
uesday, May 24, 2016 2:01 PM
> To: r-help@r-project.org
> Subject: [R] Sprintf to call data frame from environment
>
>
> 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!
>
&g
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!
sprintf("Samples_%s.txt", 1)$V1
Note: I need to do it in this way because I have the code into a for loop.
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.
Note: I need to do it in this way because I have the code into a for loop.
sprintf("Samples_%s.txt", 1)$V1
__
R-help@r-pr
5 matches
Mail list logo