我正在尝试从带有 Have 包的 SPSS por 文件中访问变量标签(这是变量的描述)。我可以用外国包裹做得很好,但我想用避风港。有什么建议么?
# Using foreign I can get the variable labels
with_foreign <- foreign::read.spss(mydata.por)
attr(with_foreign, "variable.labels")
# With haven I get null
with_haven <- haven::read_spss(mydata.por)
attr(with_haven, "variable.labels")
# Some things I've experimented with
labelled::var_label(with_haven) # NULL
attributes(with_haven) # Not useful
as_factor(with_haven$var1) # Gives me definitions for factor levels (not what I need)