R language - how to list variables in use [closed]

How can I generate a list of all the variables that have been assigned in an R language session?

• Since this doesn't involve actual computations, it is off-topic here. It is likely better suited for the R forums or StackOverflow. Dec 5 '13 at 19:40
• I'm more inclined to keep it here for now, if it gets answered, because I believe it would fall under the header of "Software packages or languages used in computational science". If we get enough questions on R language syntax, then we can talk about migrating & clarifying our scope. I also agree this question would also be answered well on an R forum. Given our current traffic, I'd rather be permissive, build community, and narrow scope later with more data (and traffic) than exclude what looks reasonable for now. Dec 5 '13 at 19:53

For the sake of completeness of the answer, you can use ls() to list all the assigned variables and data frames. This is similar to who and whos in Matlab.
ls()[grepl('data.frame', sapply(ls(), function(x) class(get(x))))]