title: How to use variable labels in an R data frame
body: <p>I am trying to assign and then use variable labels and then give my work to a novice R programmer who is experienced with SPSS.
  When the other programmer uses the data, she will want to make tables. She might not remember what h1 is but will know what &quot;Heights in feet&quot; is.</p>
  <p>I have assigned the labels. Now how do I use them?</p>
  <p>Clarification: Once I have the labels, I want to use the labels the way I would use column names. So in RStudio if I type &quot;heights$&quot;, I want to see &quot;Heights in feet&quot; as an option. But I do not want to lose the column name.</p>
  <pre><code>library(Hmisc) # variable labels
  heights = data.frame(h1 = c(4,5,6, 4), h2 = c(48, 60, 72, 48))
  label(heights$h1) = &quot;Heights in feet&quot;
  label(heights$h2) = &quot;Heights in inches&quot;
  heights
  
  table(heights[[`Heights in feet`]]) # Not correct
  table(heights[`Heights in feet`]) # Not correct
  table(heights$`Heights in feet`) # Not correct
  </code></pre>
  <p>Ideas much appreciated.</p>