我正在使用 R 的 Haven 包来读取带有user_na=TRUE
. 该文件有许多带有值标签的字符串变量。在 R 中,只有第一个字符串变量 ( SizeofH1
) 具有分配给它的正确值标签作为属性。不幸的是,我什至无法提供此数据的片段以使其完全可重现,但这是我在 PSPP 中看到的屏幕截图
以及str()
R中的返回...
$ SizeofH1:Class 'labelled' atomic [1:280109] 3 3 3 3 ...
..- attr(*, "label")= chr "Size of Household ab 2002"
..- attr(*, "format.spss")= chr "A30"
..- attr(*, "labels")= Named chr [1:9] "1" "2" "3" "4" ...
..- attr(*, "names")= chr [1:9] "4 Persons" "2 Persons" "1 Person 50 years plus" "3 Persons" ...
$ PROMOTIO: atomic 40 1 40 40 ...
..- attr(*, "label")= chr "PROMOTION"
..- attr(*, "format.spss")= chr "A30"
$ inFMCGfr: atomic 1 1 1 1 ...
..- attr(*, "label")= chr "in FMCG from2011"
..- attr(*, "format.spss")= chr "A30"
$ TRADESEG: atomic 1 1 1 1 ...
..- attr(*, "label")= chr "TRADE SEGMENT"
..- attr(*, "format.spss")= chr "A30"
$ ORGANISA: atomic 111 111 111 111 ...
..- attr(*, "label")= chr "ORGANISATION"
..- attr(*, "format.spss")= chr "A30"
$ NAME : atomic 9 9 9 9 ...
..- attr(*, "label")= chr "NAME"
..- attr(*, "format.spss")= chr "A30"
我希望有人可以指出导致这种行为的任何可能原因。