In a folder I have an unfixed number of files (for example 4), each file contains 3 columns of data (day, temperature, pressure).
Example:
in the folder there are: file1.txt, file2.txt, file3.txt, file4.txt
file1.txt file2.txt. file3.txt. file4.txt
D1_1 T1_1 P1_1 D2_1 T2_1 P2_1 D3_1 T3_1 P3_1 D4_1 T4_1 P4_1
D1_2 T1_2 P1_2 D2_2 T2_2 P2_2 D3_2 T3_2 P3_2 D4_2 T4_2 P4_2
... ... ... ... ... ... ... ... ... ... ... ...
I would like the R code to open all the files in the folder and save them in 3 separate files (Day, temperature, pressure)
legend Xn1_n2:
X=(D =day,T=temperature, P=pressure);
n1=(1,2,3,4 number of the file);
n2=number of measurements in the file;
These files should be:
Day. temperature. pressure
D1_1 D2_1 D3_1 D4_1 T1_1 T2_1 T3_1 T4_1 T1_1 T2_1 T3_1 T4_1
D1_2 D2_2 D3_2 D4_2 T1_2 T2_2 T3_2 T4_2 T1_2 T2_2 T3_2 T4_2
... ... ... ... ... ... ... ... ... ... ... ...
Can you help me?
txt
files, you can use the methods in this answer – Tung