larmarange / labelled

Manipulating labelled vectors in R
https://larmarange.github.io/labelled/
GNU General Public License v3.0
75 stars 16 forks source link

Returning full variable labels #150

Closed carecodeconnect closed 1 year ago

carecodeconnect commented 1 year ago

Thanks for writing such a great package!

I have imported an SPSS .sav file into R using haven::read_sav and have noticed that long variable labels get truncated (to between around 100-140 characters).

I seem to be unable to read the entire original variable labels as they appeared in SPSS. This is the case whether I use var_label(data$variable), attr(data$variable, "label"), or str(data$label). Using the latter command returns __truncated__ following the label character.

The same thing happens when I import the .sav file into Python using pyreadstat and pandas.read_spss

Do you know if there is a maximum character length when importing variable labels from .sav files into R or Python? Is there a way to read these that is not truncated?

Thanks in advance for your help!

larmarange commented 1 year ago

Hi,

Sorry, but I'm not aware of such a limitation.

The issue is related to the way data is imported by haven. You should raise the issue there: https://github.com/tidyverse/haven or in ReadStat https://github.com/WizardMac/ReadStat the tool used by haven for importing SPSS data.

Unfortunately, there is nothing I can do at labelled level.

carecodeconnect commented 1 year ago

Thanks a lot for your quick reply!

I've reported a new issue on the haven repository.