View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
09392Bug reportsImport/Exportpublic2015-05-20 11:11
Reporterabarcomb Assigned Toc_schmitz  
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09392: R-Export writes R syntax file which incorrectly interprets optional binary responses

Using the R-export function produces an R script which does not correctly interpret optional binary responses. It appears to make no difference whether you make use of 'answer codes' or 'full answers' in the export.

In the R data file export (example.csv), row 16 has a value of '1' and row 17 has a value of '2'. In the CSV export (example-spreadsheet.csv) it can be seen that the corresponding values are 'no' and 'yes' (rows 17 and 18 due to the header). The R syntax file (example.R), however, incorrectly describes how '1' and '2' should be interpreted, treating all numeric values as 'yes'. After importing the file I see:

G2_Q0003_1 freq
1 Yes 171
2 <NA> 116
[1] Yes Yes
Levels: Yes Not selected

The flaw in the R syntax file is pretty obvious and easy to correct, once you are aware of the issue. So hopefully it is a simple matter to fix the R-export function to output a correct R script.

Steps To Reproduce
  1. Create a survey with an optional question with 'yes' and 'no' as options.
  2. Fill in the survey three times, once with 'yes', once with 'no' and once without answering the question.
  3. Export the R data file and R syntax file using R-export.
  4. Import the R syntax file in R.

The result will be two 'yes' answers and one 'N/A' answer.

Additional Information

The attached data files are the export of the responses to a single question in an actual survey. The title of the question has been changed. The R syntax file has been changed to point to 'example.csv' instead of the automatically assigned survey number.

TagsNo tags attached.
Attached Files
example.tgz (1,463 bytes)
Bug heat4
Complete LimeSurvey version number (& build)140320
I will donate to the project if issue is resolvedNo
Database type & versionMySQL Server version: 5.1.73-1
Server OS (if known)Debian 6.0.10
Webserver software & version (if known)Apache 2.2.22-13+deb7u3 (amd64)
PHP Versionphp (libapache2-mod-php5) 5.4.4-14+deb7u14

Users monitoring this issue

There are no users monitoring this issue.




2014-12-09 13:54

administrator   ~31204

Can you please attach the sample survey, too? Thank you!



2014-12-09 14:21

reporter   ~31214

example.tgz contains a subset of data exported from a real survey. The survey which created these results cannot be shared. I have therefore created an example survey to demonstrate the issue.

self-contained_example.tgz contains a survey that I created to demonstrate this issue. It contains the survey structure export (.lss), a CSV export of the data I entered (-spreadsheet.csv), the R syntax export (.R) and the R data export (.csv).

The CSV export shows the data as it was actually entered:
1, Yes
2, No
3, N/A

In the R export this becomes:
1, 2
2, 1
3, 1

And in the R syntax file, '1' is 'Yes' and '2' is 'No'.



2015-05-20 11:11

administrator   ~32249

Version 2.05+ Build 150520 released.

Related Changesets

LimeSurvey: master 8d25f5ea

2015-05-08 10:28:25


Details Diff
Fixed issue 08917: Error in R export plugin when exporting Yes/No question results Affected Issues
08917, 09392
mod - application/core/plugins/ExportR/RDataWriter.php Diff File

Issue History

Date Modified Username Field Change
2014-12-08 15:55 abarcomb New Issue
2014-12-08 15:55 abarcomb File Added: example.tgz
2014-12-09 13:54 c_schmitz Note Added: 31204
2014-12-09 13:54 c_schmitz Assigned To => c_schmitz
2014-12-09 13:54 c_schmitz Status new => feedback
2014-12-09 14:15 abarcomb File Added: self-contained_example.tgz
2014-12-09 14:21 abarcomb Note Added: 31214
2014-12-09 14:21 abarcomb Status feedback => assigned
2015-05-08 12:29 c_schmitz Changeset attached => LimeSurvey master 8d25f5ea
2015-05-08 12:29 c_schmitz Status assigned => resolved
2015-05-08 12:29 c_schmitz Fixed in Version => 2.05+
2015-05-08 12:29 c_schmitz Resolution open => fixed
2015-05-20 11:11 c_schmitz Note Added: 32249
2015-05-20 11:11 c_schmitz Status resolved => closed