title: Extract names of objects from list
body: <p>I have a list of objects. How do I grab the name of just one object from the list?  As in:</p>
  
  <pre><code>LIST &lt;- list(A=1:5, B=1:10)
  LIST$A
  some.way.cool.function(LIST$A)  #function I hope exists
  "A"   #yay! it has returned what I want
  </code></pre>
  
  <p>names(LIST) is not correct because it returns "A" and "B".</p>
  
  <p>Just for context I am plotting a series of data frames that are stored in a list.  As I come to each data.frame I want to include the name of the data.frame as the title.  So an answer of names(LIST)[1] is not correct either.</p>
  
  <p><strong>EDIT: I added code for more context to the problem</strong></p>
  
  <pre><code>x &lt;- c("yes", "no", "maybe", "no", "no", "yes")
  y &lt;- c("red", "blue", "green", "green", "orange")
  list.xy &lt;- list(x=x, y=y)
  
  WORD.C &lt;- function(WORDS){
  require(wordcloud)
  
  L2 &lt;- lapply(WORDS, function(x) as.data.frame(table(x), stringsAsFactors = FALSE))
  
      FUN &lt;- function(X){
          windows() 
          wordcloud(X[, 1], X[, 2], min.freq=1)
          mtext(as.character(names(X)), 3, padj=-4.5, col="red")  #what I'm trying that isn't working
      }
      lapply(L2, FUN)
  }
  
  WORD.C(list.xy)
  </code></pre>
  
  <p>If this works the names x and y will be in red at the top of both plots</p>