I have a dataset with the following structure:
the rows are participants in an experiment, and the columns are questions they answered. All the columns titled EC belong to one type of task, all those titled ART belong to another etc.
After reading the table into R, how do I tidy the data such that all questions belonging to one type of task are saved as a single variable? I basically want each type of task (all answers that all participants gave for that task) to be saved as separate variables which I can later do statistical analysis on.
I understand that gather and separate might be useful commands for this, but I don't completely understand how to use them here and I don't completely understand their syntax.
For example:
gather(data,key, value) - I think that 'key' should refer to the title I gave the variable? and the 'value' refer to the fields where the values related with that variable are locate? If so, what does 'data' refer to? I tried putting the name of the table in the 'data' field, but got an error saying 'Error: Invalid column specification'.
Can someone help?