I have been struggling for a while with this issue in R:
let's say that I have a for
loop which runs over 9 data files. In this loop, I extract a short vector from a longer vector. Easy.
After that,still during the loop, I want to fill a matrix with the freshly extracted short vector and save the matrix to a file. Not easy, because none of the short vectors have the same length. To avoid the problem, I tried to directly save (still in the loop) the vectors directly in a .csv
file with write.table()
and append=TRUE
, but R appends all the 9 vectors in the same column, when I would like to have 9 columns. Does anything like by.column=TRUE
exist?
One way or another, I only want to have my 9 short vectors in 9 columns in a data file. It looks to me that I am not too far with the second solution.
Has anyone an idea how to finally finish this little programm? I would greatly appreciate.
Thank you for your time Michel