Hi Mat,
you said that you've tried pivot_wider(), but in fact, your code uses pivot_longer(). I think you want to use pivot_wider() here and then it should work without problems.
This one worked well for me:
pivot_wider(Group_MF, names_from = Sample, names_prefix = "Sample_", values_from = Fatty_acid_1)
which gives you
| Point |
Tretment |
Milking.hour |
Sample_1 |
Sample_2 |
| Start |
High |
17:00 |
1035.6459 |
913.3947 |
| Start |
High |
02:30 |
684.8616 |
1115.6863 |
| End |
High |
17:00 |
822.0508 |
762.1805 |
| End |
High |
02:30 |
1129.3909 |
639.0239 |