I have two files:
>head(fileA)
2 1 544.8 1279.2 1.0603 3.2460 0.0542
3 1 546.2 1277.8 1.0463 3.2460 0.0553
3 2 543.9 1280.1 0.1652 3.2460 0.0177
4 1 543.7 1280.3 1.0819 3.2460 0.0527
>head(fileB)
1 Coly
2 Mony
3 Fong
4 Wow
5 Poly
I would like to assign the names in fileB to the number in fileA, to get the following output
2 Mony 1 Coly 544.8 1279.2 1.0603 3.2460 0.0542
3 Fong 1 Coly 546.2 1277.8 1.0463 3.2460 0.0553
3 Fong 2 Mony 543.9 1280.1 0.1652 3.2460 0.0177
4 Wow 1 Coly 543.7 1280.3 1.0819 3.2460 0.0527
To be honest I was not able to try anything, I just spent a lot of time looking up how to do this. The only thing that I thought about was to assign the numbers in fileA to variables and then every time this variables are found append to it the content of fileB. Unfortunately, I do not know how to do this.
Any suggestion, link, directive? Thanks