I have a data frame with 3 columns
data.frame(A=c(1, 2, 3), B=c('a', 'b', 'c'), C=c(22, 21, 22))
I would like to combine the first row with column name as the final column name So column A would be named "A_1" and would have values (a,22) and so on... Can anyone help me?
[EDIT - ANSWER] I managed this with the following:
columns = paste(names(df),as.matrix(df[1,]))
columns %>% str_remove(' NA') # to remove the "NA"'s I had in 1st row
colnames(df) = columns