[R] A way to list only variables or functions?
Shin, Daehyok
sdhyok at email.unc.edu
Sun Jun 20 17:51:30 CEST 2004
Neat! Thanks.
How about incorporating this support into standard commands, ls() or
objects()?
Daehyok Shin (Peter)
> -----Original Message-----
> From: Gabor Grothendieck [mailto:ggrothendieck at myway.COM]
> Sent: Sunday, June 20, 2004 AM 10:06
> To: sdhyok at email.unc.edu; r-help at stat.math.ethz.ch
> Subject: RE: [R] A way to list only variables or functions?
>
>
>
>
> These two functions will list the functions and variables
> respectively:
>
> ls.funs <-
> function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> (is.function(get(x)))x))
>
> ls.vars <-
> function(env=sys.frame(-1))unlist(lapply(ls(env=env),function(x)if
> (!is.function(get(x)))x))
>
>
> To use:
>
> ls.funs()
> ls.vars()
>
>
> Date: Sat, 19 Jun 2004 22:59:57 -0400
> From: Shin <sdhyok at email.unc.edu>
> To: R Help <r-help at stat.math.ethz.ch>
> Subject: [R] A way to list only variables or functions?
>
>
> I am curious if there is any way to list only variables or functions in
> current environment, rather than listing all objects? Thanks.
>
> --
> Daehyok Shin (Peter)
> Geography Department
> Univ. of North Carolina-Chapel Hill
>
>
>
> _______________________________________________
> No banners. No pop-ups. No kidding.
>
More information about the R-help
mailing list