I have a column vector that I would like to convert to a diagonal matrix.
That is I have the vector v = (1,2,3) and want to turn it into:
[1, 0, 0]
[0, 2, 0]
[0, 0, 3]
How can I do this in Excel? in R?
I don't care how I do it, I just need to get it done. I know this is a simple question but I've been trying to figure this out for hours now.
(note: my vector is currently in a csv file)