- Posts: 2
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
3 years 7 months ago #203314
by daaronr
Export a categorical question (MCQ w optional text) as single column in csv? was created 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 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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12785
- Thank you received: 3940
3 years 7 months ago #203320
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Export a categorical question (MCQ w optional text) as single column in csv?
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
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
3 years 7 months ago #203322
by daaronr
Replied by daaronr on topic Export a categorical question (MCQ w optional text) as single column in csv?
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"
"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
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
3 years 7 months ago - 3 years 7 months ago #203323
by gabrieljenik
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 .
Replied by gabrieljenik on topic Export a categorical question (MCQ w optional text) as single column in csv?
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!
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12785
- Thank you received: 3940
3 years 7 months ago - 3 years 7 months ago #203324
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Export a categorical question (MCQ w optional text) as single column in csv?
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
{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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12785
- Thank you received: 3940
3 years 7 months ago #203347
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Export a categorical question (MCQ w optional text) as single column in csv?
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
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.