I'm looking for some help with the following.
The data are into two folders. Each file is a txt file containing 16 columns and more than 7000 rows like this:
head(a1)
v1 | v2 | ... | v16 |
---|---|---|---|
2.0742 | 1.1520 | ... | 5.6852 |
-1.4071 | 1.1848 | ... | 2.7629 |
I want to transform each file into a single long column, using the library data.table like this :
library(data.table)
setDT(a1)
a1<-melt(a1)[, .(value)]
v1 |
---|
2.0742 |
-1.4071 |
1.1520 |
1.1848 |
... |
5.6852 |
2.7629 |
The idea is to build a for loop that loads each file, transforms it into a single column dataframe and then exports it into another folder.
Any idea from where to start?