[R] Variable labels

Robert Knight bobby@kn|ght @end|ng |rom gm@||@com
Sun May 16 06:20:58 CEST 2021

Actually, I just found exactly what you want.  Before that though, I am
having a hard time finding any such cool job despite having even had
classes with some great professors in economics at UND, and so I work in a
completely non data related thing.

Here is exactly what you want, code included.  Then on the right side of
Rstudio you can click the word "desc" and get a table of the variable name
and it's description.

variable <- c("year", "inv", "pop", "price", "linv", "lpop", "lprice", "t",
       "invpc", "linvpc", "lprice_1", "linvpc_1", "gprice", "ginvpc")
description <- c("1947-1988","real housing inv, millions $","population,
1000s","housing price index; 1982 = 1",
       "log(inv)","log(pop)","log(price)","time trend: t=1,...,42","per
capita inv: inv/pop",
       "log(invpc)","lprice[_n-1]","linvpc[_n-1]","lprice -
lprice_1","linvpc - linvpc_1")
desc <- cbind(variable, description)

Robert D. Knight, MBA

Developer of Meal Plan and Grocery List maker for Android and iOS.

On Wed, May 12, 2021 at 9:49 PM Steven Yen <styen using ntu.edu.tw> wrote:

> 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")
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list