I have a set of data created by users answering a questionnaire. I imported their answers from a .csv file and got them as a data frame with one user per row and one question per column.
However, the questions were not homogenous. I have to first evaluate some questions, which gives me an ordered list of the users' preferences for 10 predefined categories. Then I want to evaluate the remaining questions, and for this I have to use some information of this ordered list (for example, which is the category the user ranked highest?). I calculated the score for each category. It is currently kept in a matrix, which looks like that:
cat1.score cat2.score ... cat10.score
user1 2.50 2.25 ... 3.20
user2 3.85 2.05 ... 2.40
and I plan to create lists and sort them, so I'll get for the first user a list like preferences <- list("cat10", "cat1", "cat2", ...) (assuming that the scores not shown are lower than 2.25). But I am not sure how to structure the information. My plan was to create a new data frame, which will have the same data as the matrix, and its eleventh column will hold the list of the categories ranking for the user. I tried lots of ways to construct such a data frame, but couldn't do it.
Now I am very new to R, so I guess that I haven't thought of all ways yet, and I could try a lot more. But as I saw how hard it is to do, I guessed that maybe I am trying to do something which makes little sense - if it was a good practice, R would have probably had a convenient mechanism to do it, or the tutorial books would have had an example.
So, my question is, is this a good way to structure my intermediate results? And if not, what is a better way? I get one such list per user, and I really need it as ordered data (for each user, I will later have to access it as preferences[2] and get the category the user liked second most, or similar). To make it clear, I know which data structures in R can contain a list and which can't. My question is not what the language will let me do, but what is the sensible thing to do here.