I want to be able to read trough the variable/columns to choose useful variables for my analyis. Therefore i want to have the labels as well, since the variable names are not human-readable.
I downloaded the GLES-Dataset ZA7729 as .sav-file from https://gles.eu/bundestagswahl-2021/ and imported it into R-Studio via "import from Stata".
Then i'm able to see the variables/columns with labels,
my loaded data
but there are so many variables, that i want a more readable format, like having a list of them printed. I got close to what i wanted by using
str(ZA7729_v1_0_0)
str(ZA7729_v1_0_0)
but it prints a lot of additional information that i don't need and make it hard to read. I only want the line with @label or -attr( ,"label") for each variable/column
I tried iterating over str(ZA7729_v1_0_0) but then i found out that it only prints and does not return anything, so that's not an option. I pretty much want colnames(ZA7729_v1_0_0) but with the human readable labels instead of just the variable name.