# read the internal lessR data frame that contains variable labels
mydata <- Read("Employee", format="lessR")
# processing with a standard R transformation removes the labels
mydata <- transform(mydata, Years = Years)
# show that the labels are now gone
details.brief()
# construct and read variable labels from console
lbl <- "Years,time of company employment
Gender,Male or Female
Dept,department employed
Salary,annual salary
Satisfaction,satisfaction with work environment
HealthPlan,1=GoodHealth 2=YellowCross 3=BestCare
"
mydata <- VariableLabels(lbl)
# read variable labels from a csv file
mydata <- Read("Employee", format="lessR")
mydata <- transform(mydata, Years = Years) # remove the labels
# mydata <- VariableLabels("http://lessRstats.com/data/employee_lbl.csv")
# add/modify a single variable label
mydata <- VariableLabels(Salary, "bucks buck")
details.brief()
# list the contents of a single variable label
VariableLabels(Salary)
# display all variable labels
VariableLabels()
Run the code above in your browser using DataLab