Can anyone help me? Anyway, I'm already grateful!
Search for help with the paste
function. If your frame data is df
you can do:
re1<- apply(df[1:3,-1],2,paste,collapse="_")
nomes<- c(df[3,1],re1)
New df:
df1 <- df[-c(1:3),]
colnames(df1)<- nomes
I've already discovered ...
The correct one would be:
N_row_concatenate<-3 # Digite ao lado o número de linhas que você deseja
#concaternar para formar o nome da nova variável!!!
Head_Name <-apply(Df[1:N_row_concatenate,-(1+ncol(Df))],2,paste,collapse="_")
New_Df <- Df[-c(1:N_row_concatenate),]
colnames(New_Df)<- Head_Name
New_Df_long <- melt(New_Df, id=c(Head_Name[1:1]))
Anyway thank you very much for the initial idea. It was great!