It would be nice if value and variable labels would be imported as well, e.g. by setting them as data frame attributes (like read.spss
from foreign
package does):
_Example of read.spss_
'data.frame': 908 obs. of 26 variables:
$ c12hour : num 16 148 70 168 168 16 161 110 28 40 ...
$ e15relat: atomic 2 2 1 1 2 2 1 4 2 2 ...
..- attr(, "value.labels")= Named chr "8" "7" "6" "5" ...
.. ..- attr(, "names")= chr "other, specify" "cousin" "nephew/niece" "ancle/aunt" ...
$ e16sex : atomic 2 2 2 2 2 2 1 2 2 2 ...
..- attr(, "value.labels")= Named chr "2" "1"
.. ..- attr(, "names")= chr "female" "male"
$ e17age : num 83 88 82 67 84 85 74 87 79 83 ...
$ e42dep : atomic 3 3 3 4 4 4 4 4 4 4 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "severely dependent" "moderately dependent" "slightly dependent" "independent"
$ c82cop1 : atomic 3 3 2 4 3 2 4 3 3 3 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "always" "often" "sometimes" "never"
$ c83cop2 : atomic 2 3 2 1 2 2 2 2 2 2 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "Always" "Often" "Sometimes" "Never"
$ c84cop3 : atomic 2 3 1 3 1 3 4 2 3 1 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "Always" "Often" "Sometimes" "Never"
$ c85cop4 : atomic 2 3 4 1 2 3 1 1 2 2 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "Always" "Often" "Sometimes" "Never"
$ c86cop5 : atomic 1 4 1 1 2 3 1 1 2 1 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "Always" "Often" "Sometimes" "Never"
$ c87cop6 : atomic 1 1 1 1 2 2 2 1 1 1 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "Always" "Often" "Sometimes" "Never"
$ c88cop7 : atomic 2 3 1 1 1 2 4 2 3 1 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "Always" "Often" "Sometimes" "Never"
$ c89cop8 : atomic 3 2 4 2 4 1 1 3 1 1 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "always" "often" "sometimes" "never"
$ c90cop9 : atomic 3 2 3 4 4 1 4 3 3 3 ...
..- attr(, "value.labels")= Named chr "4" "3" "2" "1"
.. ..- attr(, "names")= chr "always" "often" "sometimes" "never"
$ c160age : num 56 54 80 69 47 56 61 67 59 49 ...
$ c161sex : atomic 2 2 1 1 2 1 2 2 2 2 ...
..- attr(, "value.labels")= Named chr "2" "1"
.. ..- attr(, "names")= chr "Female" "Male"
$ c172code: atomic 2 2 1 2 2 2 2 2 NA 2 ...
..- attr(, "value.labels")= Named chr "3" "2" "1"
.. ..- attr(, "names")= chr "high level of education" "intermediate level of education" "low level of education"
$ c175empl: atomic 1 1 0 0 0 1 0 0 0 0 ...
..- attr(, "value.labels")= Named chr "1" "0"
.. ..- attr(, "names")= chr "yes" "no"
$ barthtot: num 75 75 35 0 25 60 5 35 15 0 ...
$ neg_c_7 : num 12 20 11 10 12 19 15 11 15 10 ...
$ pos_v_4 : num 12 11 13 15 15 9 13 14 13 13 ...
$ quol_5 : num 14 10 7 12 19 8 20 20 8 15 ...
$ resttotn: num 0 4 0 2 2 1 0 0 0 1 ...
$ tot_sc_e: num 4 0 1 0 1 3 0 1 2 1 ...
$ n4pstu : atomic 0 0 2 3 2 2 3 1 3 3 ...
..- attr(, "value.labels")= Named chr "8" "7" "6" "5" ...
.. ..- attr(, "names")= chr "other, specify" "cousin" "nephew/niece" "ancle/aunt" ...
$ nur_pst : atomic NA NA 2 3 2 2 3 1 3 3 ...
..- attr(, "value.labels")= Named chr "89" "88" "87" "86" ...
.. ..- attr(, "names")= chr "other" "co-religionist" "volunteer" "neighbour" ...
- attr(, "variable.labels")= Named chr "average number of hours of care for the elder in a week" "relationship to elder" "elder's gender" "elder' age" ...
..- attr(, "names")= chr "c12hour" "e15relat" "e16sex" "e17age" ...
- attr(*, "codepage")= int 65001
_Same with haven_
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 908 obs. of 26 variables:
$ c12hour : num 16 148 70 168 168 16 161 110 28 40 ...
$ e15relat: num 2 2 1 1 2 2 1 4 2 2 ...
$ e16sex : num 2 2 2 2 2 2 1 2 2 2 ...
$ e17age : num 83 88 82 67 84 85 74 87 79 83 ...
$ e42dep : num 3 3 3 4 4 4 4 4 4 4 ...
$ c82cop1 : num 3 3 2 4 3 2 4 3 3 3 ...
$ c83cop2 : num 2 3 2 1 2 2 2 2 2 2 ...
$ c84cop3 : num 2 3 1 3 1 3 4 2 3 1 ...
$ c85cop4 : num 2 3 4 1 2 3 1 1 2 2 ...
$ c86cop5 : num 1 4 1 1 2 3 1 1 2 1 ...
$ c87cop6 : num 1 1 1 1 2 2 2 1 1 1 ...
$ c88cop7 : num 2 3 1 1 1 2 4 2 3 1 ...
$ c89cop8 : num 3 2 4 2 4 1 1 3 1 1 ...
$ c90cop9 : num 3 2 3 4 4 1 4 3 3 3 ...
$ c160age : num 56 54 80 69 47 56 61 67 59 49 ...
$ c161sex : num 2 2 1 1 2 1 2 2 2 2 ...
$ c172code: num 2 2 1 2 2 2 2 2 NaN 2 ...
$ c175empl: num 1 1 0 0 0 1 0 0 0 0 ...
$ barthtot: num 75 75 35 0 25 60 5 35 15 0 ...
$ neg_c_7 : num 12 20 11 10 12 19 15 11 15 10 ...
$ pos_v_4 : num 12 11 13 15 15 9 13 14 13 13 ...
$ quol_5 : num 14 10 7 12 19 8 20 20 8 15 ...
$ resttotn: num 0 4 0 2 2 1 0 0 0 1 ...
$ tot_sc_e: num 4 0 1 0 1 3 0 1 2 1 ...
$ n4pstu : num 0 0 2 3 2 2 3 1 3 3 ...
$ nur_pst : num NaN NaN 2 3 2 2 3 1 3 3 ...