Sorting columns according to rows' values

Can you provide a REPRoducible EXample (reprex) for this?