'How to replace all variable names with the contents of the first row in a tibble

Is there a quick way to replace variable names with the content of the first row of a tibble?

So turning something like this:

Subject  Q1   Q2      Q3
Subject  age  gender  cue
429753   24   1       man
b952x8   23   2       mushroom
264062   19   1       night
53082m   35   1       moon

Into this:

Subject  age  gender  cue
429753   24   1       man
b952x8   23   2       mushroom
264062   19   1       night
53082m   35   1       moon

My dataset has over 100 variables so I'm looking for a way that doesn't involve typing out each old and new variable name.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source