0
votes

I imported a dataset in the .sav SPSS format, and I'm getting an error that I haven't seen before.

1: In read.spss("C:\\Users\\acer\\Desktop\\X\\X\\PIREDEU\\ees2009_v0.9_20110622.sav",  ... :
  C:\Users\acer\Desktop\X\X\PIREDEU\ees2009_v0.9_20110622.sav: File contains duplicate label for value 1.1 for variable V200 
Error in cat(list(...), file, sep, fill, labels, append) : 
  argument 2 (type 'list') cannot be handled by 'cat'

This came up after I typed warnings(PIREDEU). I imported the data using the foreign library:

library(foreign)
PIREDEU<-read.spss("C:\\Users\\acer\\Desktop\\X\\X\\PIREDEU\\ees2009_v0.9_20110622.sav", use.value.labels=TRUE, max.value.labels=Inf, to.data.frame=TRUE)

I've fiddled with various combinations for the latter three arguments of the read.spss function, and I've gotten nowhere.

Anyone have any suggestions?

4
Without seeing the actual file it's hard for me to say what's going wrong. Have you checked variable names that they are indeed no duplicates? - Roman Luštrik
These are only warnings. Is there some real problem with the data import? - IRTFM

4 Answers

2
votes

I used the below one and it worked perfectly, just ignore the warning message and check data by typing its name:

mydata4<-read.spss("C:\\Work\\data.sav",use.value.labels=F,to.data.frame=T)
mydata4 # check data
0
votes

Do you have long strings in the file - longer than 8 bytes? Statistics uses some special arrangements to handle those. It looks like the problem is with the value labels. If you can delete those (using SPSS) you might be able to get the rest of the data.

0
votes

Try to read data without labels.

library(foreign)

PIREDEU <- read.spss("C:\\Users\\acer\\Desktop\\X\\X\\PIREDEU\\ees2009_v0.9_20110622.sav",
  use.value.labels = F,
  to.data.frame = T)

Does it work?

0
votes

Convert the spss datafile into .por (portable file) and in R, install the packages hMisc, memisc and foreign and load the package using library(foreign), library(hMisc) and library(memisc).

Then type the following:

mydata <- spss.get("c:/mydata.por", use.value.labels=TRUE)
# last option converts value labels to R factors