[R] Variable labels

Steven Yen @tyen @end|ng |rom ntu@edu@tw
Thu May 13 10:07:02 CEST 2021

Thanks. What I need “appears” simple. The .RData file is provided by a third party (likely converted from a different data format such as SAS in which variable labels (not value labels) are common). When I load the binary file, in the “environment” I see, as expected, a data frame showing how many observations for how many variables. In addition, there is also an item (in the environment) (say “desc”) containing a list of variable labels (definitions).  I simply like to know how to get “desc” in the environment—-it is a convenient way to show definitions of all variables when you send a binary data file to a third party. Thank you.

> On May 13, 2021, at 2:57 PM, Fredrik Karlsson <dargosch using gmail.com> wrote:
> Hi,
> I am sorry but I don't understand your question, Generally, "clicking" is not something you can assume to be implemented for anything in R.
> However, if you read the manual for the package 
>  https://gdemin.github.io/expss/
> you get an example at the bottom where an illustration of how the package can be used to create Excel tables which would then be easy to interact with through clicking.
> Is that what you wanted?
> Fredrik
>> On Thu, May 13, 2021 at 4:49 AM 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.
> -- 
> "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it."

	[[alternative HTML version deleted]]

More information about the R-help mailing list