[R] A way to list only variables or functions?

Duncan Murdoch dmurdoch at pair.com
Mon Jun 21 16:39:54 CEST 2004


On Mon, 21 Jun 2004 09:53:35 -0400, "Shin, Daehyok"
<sdhyok at email.unc.edu> wrote :

>Glad to know useful functions.
>How about adding lsv.str function to list only variables bound to values?
>In my opinion, we are more interested in values than functions in the
>process of data analysis.

In R, functions often contain useful information about data (in their
attached environments).  For example, the result of a smoothing fit
could include a function that calculates the fitted value at any
point.  So the distinction between functions and values isn't as clear
as you seem to be thinking.

However, it would be useful to get a slightly more informative version
of ls(), that returned a data.frame containing the name, length,
class, and other useful information for each object. Then if you
didn't want to see functions, you'd just select based on the class (or
mode, or some other column).

I seem to recall that S-PLUS has such a function, but I forget the
name of it.   Probably R does too, on CRAN if not in the base
packages.

Duncan Murdoch




More information about the R-help mailing list