6
$\begingroup$

I have just carried out a questionnaire which has a number of questions which are multi-answer and multi-choice. That is, the respondent can tick as many of the options as apply to them - so they may choose no items, one, two, or seven! There is also an 'Other' field for those who find the options don't apply to them.

My question is: how should I store this data (within the R language) so that I can analyse it most easily? The sort of analyses I'd like to do are generally fairly simple - looking at the percentages of different responses within the questions, and won't involve much that is hugely deep statistics (I don't really have a large enough sample size to do this).

I can think of a number of ways to store the data, as listed below, but I'm not sure which will work best and be easiest to deal with. Other people must have dealt with these issues before and found out how best to do it - so what do you think?

Possible ideas I've had include:

  • Use a single column of a dataframe for each question, which contains some sort of comma-separated list - easy to input the data, but I suspect it'll be hard to analyse
  • Multiple columns for each question - up to the maximum number of answers that I think anyone will tick (5-6 I suspect - but what if I get more?) and put the name of the answer in each of these columns
  • A column for each possible answer and use boolean values in the columns to signify what has been ticked. This probably sounds better, but I'm not sure how I'd then go about analysing it.

What do people think?

$\endgroup$
4
$\begingroup$

The last answer is the best one for your situation. The basic approach is that each check-box should be stored as a 0 (unchecked) or 1 (checked). If you have logic in the questionnaire so some people do not get asked the question, you can have 0 (exposed to question, but unchecked), 1 (checked) and missing/null (not exposed to question).

The analysis can be very easy - sum up the values in the column (ie count all the 1s) and divide by the number of responses (count all the 1s and 0s). That's the percentage that checked the box and where you can start.

In some situations, when you have a very wide range of possible answers and each respondent has responses on a small set of that range, it may be more efficient to store each record as a combination of the respondent id, the response type, and the value of the response. This helps you avoid having a table with hundreds or thousands of columns which can be unwieldy for storage purposes.

$\endgroup$
4
$\begingroup$

Your last option sounds the best to me. Analyzing, is just filtering on that column of the data frame.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.