This is a double barrelled R question. I have a folder of data sets (in .csv) and they need to be altered before analysis. Each data set is a 1X10 matrix like:
1 2 3 4 5 6 7 8 9 10
and need to turn it into into the following 5X5 matrix inserting 1s on the diagonal:
1
1 1
2 3 1
4 5 6 1
7 8 9 10 1
How can accomplish this transformation on multiple files in a folder?
Try this: