Hi @melgoussi,
Here is some code that separates the "raw" data in each column of your STATA dta file from the corresponding value labels, and stores those labels in a new column. This is done for every column in the original dataframe. You can then select the columns best suited to your needs.
# library(tidyverse)
# library(haven)
# df <- read_dta("2021-PPI-Full.dta")
# Can 'extract' the labels as a factor for each column in the dataframe.
# Then give these columns unique new names.
labels.df <- haven::as_factor(df, levels="labels")
names(labels.df)[3:59] <- paste0(names(labels.df)[3:59], "_label")
head(labels.df)
# Remove unwanted labels in original dataframe (keeping only the raw data).
# Then give these columns unique new names.
cleaned.df <- zap_labels(df)
names(cleaned.df)[3:59] <- paste0(names(cleaned.df)[3:59], "_raw")
head(cleaned.df)
# Join all the new columns, and select those required (or keep them all).
left_join(cleaned.df, labels.df, by=c("ID", "IY")) %>%
select(ID, IY, contains("country"), contains("IDA")) -> combined.df
# If original columns do NOT have value labels (but only labelled vector names),
# then the "xxx_raw" and the corresponding "xxx_label" columns will have the
# same contents.
I do not fully understand if you just want the label values as attributes inside the dataframe, or if you would like to pull the labels out to a new column (which has be answered by @DavoWW).
I would suggest to just load the data using haven::read_dta and then use dplyr::mutate (or collapse::ftransform/collapse::fmutate) to transform the relevant columns into a factor, using haven::as_factor. Then, you would have ordinary factors to work with in your data.frame and if you look at the columns, the labels are shown as entries.