Hello,
I would like to change "label" attribute in a tibble sourced from an SPSS sav file.
I noticed that the following notation works:
attr(df$colname, "label")
as it gives me the label value as found in original sav file, whereas
attr(df[,colnumber], "label")
returns NULL (where colnumber is an actual number of a column)
Why is this? Am I coding something wrong.
The reason: I am trying to make a for loop to change one part of several labels at once using gsub.
It works with first notation, but I can only make a for loop using second notation, where colnumber is changing. This is why I would like attr() to work in the second case presented above.
Any suggestions are welcome.