Re: [R] Use gather with a various number of columns

2019-08-28 Thread ruipbarradas
Hello, Just don't include the names of those columns. Is this what you want? library(tidyr) df_initial1 <- data.frame(col1name=c(1,2,3,4,5,6,7), col2name=c(4,5,6,7,8,9,1), col3name=c(9,8,7,6,5,4,3)) df_initial2 <- data.frame(col1name=c(1,2,3,4,5,6,7), col2name=c(4,5,6,7,8,9,1)) df_initial3

[R] Use gather with a various number of columns

2019-08-27 Thread lionel sicot via R-help
Hello, I'm using the gather function from the tidyr package to reshape data.frames. For example, for the the following dataframe, I apply the command below.df_initial<-data.frame(col1name=c(1,2,3,4,5,6,7), col2name=c(4,5,6,7,8,9,1), col3name=c(9,8,7,6,5,4,3))df_reshaped<-gather(df_initial, "col1