I need to gather_ for all columns of the data frame except one. Example:
Now suppose that I want to collect all the columns except column e . This will not work:
mycol <- "e" foo_melt <- gather_(foo, key = "variable", value = "value", -mycol) #Error in -mycol : invalid argument to unary operator
It will be:
column_list <- colnames(foo) column_list <- column_list[column_list != mycol] foo_melt <- gather_(foo, key = "variable", value = "value", column_list)
It looks pretty confusing if you ask me. Is there an easier way?
source share