View Issue Details

This issue affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
10686Bug reportsImport/Exportpublic2020-03-13 18:46
Reporterjmsanchez Assigned Toollehar  
PrioritynormalSeveritypartial_block 
Status closedResolutionopen 
Product Version2.06+ 
Summary10686: Export Radio with other to R, wrong syntax file
Description

When export Radio with other to R, other is coded as -oth-. R syntax file transform variable as.numeric() so NA's are coerced and -oth- codification is lost.

This means that all subsequent analysis using this data are wrong.

Steps To Reproduce
  1. Create a Radio question
  2. check other as yes
  3. introduce data selecting other option
  4. export to R
TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)160303
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql 5.1.73-1
Server OS (if known)?debian?
Webserver software & version (if known)apache 2.2.16-6+squeeze15
PHP Version5.3.29-1

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2016-03-09 16:29

administrator   ~36221

Last edited: 2016-03-09 16:37

What would you prefer instead of "-oth-"? Leaving it empty? Or a magic number like -1?

jmsanchez

jmsanchez

2016-03-09 20:28

reporter   ~36237

Last edited: 2016-03-09 20:28

I think the problem is in R syntax file, not coding. This is a real example:

data[, 94] <- as.numeric(data[, 94])
attributes(data)$variable.labels[94] <- "Question one?"
data[, 94] <- factor(data[, 94], levels=c(1,2,3,4,5,6),labels=c("Aw 1", "Aw 2", "Aw 3", "Aw 4", "Aw 5", "Aw 6"))
names(data)[94] <- "g02p17"

When you run this lines, R gives a warning message "NAs introduced by coercion". What I do in my R syntax file is:

data[, 94] <- as.numeric(data[, 94])

attributes(data)$variable.labels[94] <- "Question one?"
data[, 94] <- factor(data[, 94], levels=c("1","2","3","4","5","6","-oth-"),labels=c("Aw 1", "Aw 2", "Aw 3", "Aw 4", "Aw 5", "Aw 6","Other"))
names(data)[94] <- "g02p17"

My suggestion is that, when syntax file is generated for export, not convert column to numeric and add "-oth-" as a level and label in factor function.

ollehar

ollehar

2016-03-11 13:47

administrator   ~36405

Wouldn't it lead to problems that radio question is numeric or character depending on "Other" option?

jmsanchez

jmsanchez

2016-04-22 15:45

reporter   ~37715

I think no.

c_schmitz

c_schmitz

2020-03-13 18:46

administrator   ~56472

This version of LimeSurvey is not longer supported. Please check so that the issue is fixed in a more recent version of LimeSurvey. If it's not, please reopen this bug report. Thank you.

Issue History

Date Modified Username Field Change
2016-03-04 16:57 jmsanchez New Issue
2016-03-04 16:57 jmsanchez File Added: survey_archive_291645.lsa
2016-03-09 15:53 ollehar Assigned To => ollehar
2016-03-09 15:53 ollehar Status new => assigned
2016-03-09 16:29 ollehar Note Added: 36221
2016-03-09 16:29 ollehar Status assigned => feedback
2016-03-09 16:37 ollehar Note Edited: 36221
2016-03-09 20:28 jmsanchez Note Added: 36237
2016-03-09 20:28 jmsanchez Status feedback => assigned
2016-03-09 20:28 jmsanchez Note Edited: 36237
2016-03-11 13:47 ollehar Note Added: 36405
2016-03-11 13:56 ollehar Assigned To ollehar => mdekker
2016-03-11 13:56 ollehar Status assigned => feedback
2016-03-31 10:55 LouisGac Priority high => normal
2016-04-05 18:13 ollehar Assigned To mdekker => ollehar
2016-04-05 18:13 ollehar Status feedback => assigned
2016-04-22 15:45 jmsanchez Note Added: 37715
2020-03-13 18:46 c_schmitz Note Added: 56472
2020-03-13 18:46 c_schmitz Status assigned => closed