With the f开发者_如何学Coreign
package, I'm reading in a .sav file. When I open the file with PSPP there are 95 variables. However, read.spss("file")
responds with a list of 353 variables. The extra variables are blank filled fields with 220 spaces. Has anyone ever experienced this?
Before you ask, I am unable to provide a reproducible example, as the data file and its contents are proprietary.
One obvious solution would be to search for list elements that contain only spaces and set them the list element to NULL or each element with 220 spaces to NA and then drop NA columns.
But I'd like to avoid having to further post process my files if necessary. Does anyone have a fix for this?
I've had something similar before. This happened when the data was exported from SPSS CATI (the field interview application), rather than the SPSS we know and love.
In my case the resolution was to play around with the arguments to read.spss
. I found that setting use.missings=FALSE
resolved the problem, i.e. something like:
read.spss(global$datafile, to.data.frame=TRUE, use.missings=FALSE)
Good luck, and my sympathy. I know how frustrating this was for me.
精彩评论