0
votes

I'm trying to import a SPSS portable file (extension .por) into R. I'm using the haven package. I noticed that when I import .por files, variable labels are not imported into R. This is in contrast with importing .sav files, where variable labels are included.

I checked the data in SPSS and they all have labels - both the .por files and the .sav files. Is there any way I can make R import those labels?

P.S. by "labels" I mean column descriptions, like, for example "2016 YEAR OF ADMINISTRATION" in the following picture:

enter image description here

1

1 Answers

0
votes

Strange. It works for me with haven version 1.1.2.

> library(haven)
> x = read_spss("VPCPCE_UA.por")
> str(x)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   1000 obs. of  207 variables:
 $ P1      : num  1 2 3 4 5 6 7 8 9 10 ...
  ..- attr(*, "label")= chr "INTERVIEW NUMBER"
  ..- attr(*, "format.spss")= chr "F4.0"
  ..- attr(*, "display_width")= int 0
 $ P2      : num  1027 1027 1027 1027 1027 ...
  ..- attr(*, "label")= chr "INTERVIEWER ID"
  ..- attr(*, "format.spss")= chr "F4.0"
  ..- attr(*, "display_width")= int 0
 $ P3      : num  812 1212 712 1112 1112 ...
  ..- attr(*, "label")= chr "DATE"
  ..- attr(*, "format.spss")= chr "F4.0"
  ..- attr(*, "display_width")= int 0
 $ P4      : num  1558 1725 1910 540 1750 ...
  ..- attr(*, "label")= chr "START TIME"
  ..- attr(*, "format.spss")= chr "F4.0"
  ..- attr(*, "display_width")= int 0
  ...

> sessionInfo()
R version 3.5.1 (2018-07-02)
...
[1] haven_1.1.2