Here's a pretty handy feature that I picked up somewhere and got a little better. It may be nice to store in a directory.
list.objects <- function(env = .GlobalEnv) { if(!is.environment(env)){ env <- deparse(substitute(env)) stop(sprintf('"%s" must be an environment', env)) } obj.type <- function(x) class(get(x, envir = env)) foo <- sapply(ls(envir = env), obj.type) object.name <- names(foo) names(foo) <- seq(length(foo)) dd <- data.frame(CLASS = foo, OBJECT = object.name, stringsAsFactors = FALSE) dd[order(dd$CLASS),] } > x <- 1:5 > d <- data.frame(x) > list.objects()
Rich Scriven Jun 23 '14 at 4:55 a.m. 2014-06-23 04:55
source share