There is a solution for reading the SPSS data file in R using the ODBC driver.
1) There is an IBM SPSS Statistics Data File Driver . I could not find the download link. I got it from my SPSS provider. A standalone driver is all you need. You do not need SPSS to install or use the driver.
2) Create a DSN for the SPSS data driver.
3) Using the RODBC package, you can read any SPSS data file in R. You can get value labels for each variable as separate tables. Then you can use labels in R in any way you wish.
Here is a working example on Windows (now I do not have SPSS on my computer) to read an example data file in R. I have not tested this on Linux. It probably also works on Linux because there is an SPSS data driver for Linux.
require(RODBC)
For example, we can use these value labels for two variables:
[[5]] VAR00002 VAR00002_label 1 1 Male 2 2 Female [[6]] VAR00003 VAR00003_label 1 2 Student 2 3 Employed 3 4 Unemployed
Additional Information
Here is a function that allows you to read SPSS data after connecting to the SPSS data file. The function allows you to specify a list of selected variables. If value.labels=T selected variables with value labels in the SPSS data file are converted to R-factors with labels attached.
I have to say that I am not happy with the performance of this solution. It works well for small data files. The RAM limit is reached quite often for large SPSS data files (even a subset of variables is selected).
get.spss <- function(channel, variables = NULL, value.labels = F) { VarNames <- sqlQuery(channel = channel, query = "SELECT VarName FROM [Variables]", as.is = T)$VarName if (is.null(variables)) variables <- VarNames else { if (any(!variables %in% VarNames)) stop("Wrong variable names") } if (value.labels) { ValueLabelTableName <- sqlQuery(channel = channel, query = "SELECT VarName FROM [Variables] WHERE ValueLabelTableName is not null", as.is = T)$VarName ValueLabelTableName <- intersect(variables, ValueLabelTableName) } variables <- paste(variables, collapse = ", ") data <- sqlQuery(channel = channel, query = paste("SELECT", variables, "FROM [Cases]"), as.is = T) if (value.labels) { for (var in ValueLabelTableName) { VL <- sqlQuery(channel = channel, query = paste0("SELECT * FROM [VLVAR", var,"]"), as.is = T) data[, var] <- factor(data[, var], levels = VL[, 1], labels = VL[, 2]) } } return(data) }