I'm trying to use the gather function to combine multiple rows and lengthen my wide data. Example data below:
Ideally, I want the data to look like the below table so I can summarize info about the books:
When I try to use column indexing in the gather function...
data_clean <- gather(data, Book_Num, Book, data[c(2,4,6,8)]
I get the following error:
"Error: data[c(2,4,6,8)]
must evaluate to column positions or names, not a list"
Anyone know what that error means and/or if there is a better way to handle this task?