Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Export a categorical question (MCQ w optional text) as single column in csv?

  • daaronr
  • daaronr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 7 months ago #203314 by daaronr
I've many survey questions that are MCQ with optional text boxes. I want to export to csv to input to R.

The export function seems to always export these as multiple dummy columns.

I just want each to be a single dummy column. How can this be done?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 7 months ago #203320 by Joffm
As this is the usual way to export multipunch question there is no way to do this.

No way?
Well, you may try to create a question of type equation and use the "list"- or "join"-function to generate a string in one column.
See "Implemented functions" in the manual.

Tell us how you would like to have the output.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • daaronr
  • daaronr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 7 months ago #203322 by daaronr
Thanks. Suppose the question asks:

"Which colors do you like?"

A. Red
B. Blue
C. Green

I would like it to export responses such as
1. "Red", "Blue"
2. "Red"
3. "Blue"
4. "Blue", "Green"
The topic has been locked.
  • gabrieljenik
  • gabrieljenik's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 7 months ago - 3 years 7 months ago #203323 by gabrieljenik
Hi,

This could be achieved by creating a custom export plugin.
Please feel free to contact us at gabriel@encuesta.biz if you need assistance creating one.


Thanks!

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .

Last edit: 3 years 7 months ago by gabrieljenik.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 7 months ago - 3 years 7 months ago #203324 by Joffm
This you may get by using the "list"-function
{list(that.Q1.shown)}




If desired you may add the quotes by some equations like "str_replace" to replace the ',' with '","'
and add a leading and trailing quote.

{join('"',str_replace(', ','","',list(that.Q1.shown)),'"')}


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 7 months ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 7 months ago #203347 by Joffm
Just to add:
If the answer to the multiple question may be empty you have to add an IF-statement.
Otherwise your result will still have the two double quotes.

{if(count(that.Q1)>0,join('"',str_replace(', ','","',list(that.Q1.shown)),'"'),"")}

Don't get confused about single quotes and double quotes. Therefore the double quotes in red,

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose