I have a data frame with labeled columns meaning I have both column names and one label for each column. The following code creates an analogous data frame:
data(mtcars)
mtcars = apply_labels(mtcars,
mpg = "Miles/(US) gallon",
cyl = "Number of cylinders",
disc = "Displacement (cu. in.)",
hp = "Gross horsepower",
drat = "Rear axle ratio",
wt = "weight (1000 lbs)",
qsec = "1/4 mile time",
vs = "Engine",
am = "Transmission"
gear = "Number of forward gears"
carb = "Number of carburetors"
My goal is to select columns by their labels ("Miles/(US) gallon", etc.). Does anyone know how to get access to those or know a function returning those labels?
Thank you very much for your help.