[R] Variable labels

Steven Yen @tyen @end|ng |rom ntu@edu@tw
Thu May 13 04:48:43 CEST 2021


I insert variable with the expss function as shown below. No error 
message. My question is, how to save the variable labels in the data 
frame so that I can click to read the labels. Thank you.

mydata<-read_excel("data/Excel/hseinv.xlsx",na=".")
library(expss)
mydata=apply_labels(mydata,
                     year   ="1947-1988",
                     inv    ="real housing inv, millions $",
                     pop    ="population, 1000s",
                     price  ="housing price index; 1982 = 1",
                     linv   ="log(inv)",
                     lpop   ="log(pop)",
                     lprice  ="log(price)",
                     t       ="time trend: t=1,...,42",
                     invpc   ="per capita inv: inv/pop",
                     linvpc  ="log(invpc)",
                     lprice_1="lprice[_n-1]",
                     linvpc_1="linvpc[_n-1]",
                     gprice  ="lprice - lprice_1",
                     ginvpc  ="linvpc - linvpc_1")



More information about the R-help mailing list